From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- .../elements/after-same-line-gen-computed-names.js | 77 ++++++ .../after-same-line-gen-computed-symbol-names.js | 72 ++++++ ...privatename-identifier-semantics-stringvalue.js | 107 +++++++++ .../after-same-line-gen-literal-names-asi.js | 62 +++++ .../elements/after-same-line-gen-literal-names.js | 75 ++++++ .../after-same-line-gen-private-field-usage.js | 47 ++++ ...er-same-line-gen-private-method-getter-usage.js | 47 ++++ .../after-same-line-gen-private-method-usage.js | 47 ++++ .../elements/after-same-line-gen-private-names.js | 69 ++++++ ...ame-line-gen-rs-field-identifier-initializer.js | 84 +++++++ .../after-same-line-gen-rs-field-identifier.js | 91 +++++++ .../after-same-line-gen-rs-private-getter-alt.js | 126 ++++++++++ .../after-same-line-gen-rs-private-getter.js | 126 ++++++++++ .../after-same-line-gen-rs-private-method-alt.js | 125 ++++++++++ .../after-same-line-gen-rs-private-method.js | 125 ++++++++++ .../after-same-line-gen-rs-private-setter-alt.js | 125 ++++++++++ .../after-same-line-gen-rs-private-setter.js | 125 ++++++++++ ...-same-line-gen-rs-privatename-identifier-alt.js | 107 +++++++++ ...en-rs-privatename-identifier-initializer-alt.js | 101 ++++++++ ...ne-gen-rs-privatename-identifier-initializer.js | 101 ++++++++ ...fter-same-line-gen-rs-privatename-identifier.js | 107 +++++++++ ...-generator-method-privatename-identifier-alt.js | 131 ++++++++++ ...sync-generator-method-privatename-identifier.js | 132 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 131 ++++++++++ ...s-static-async-method-privatename-identifier.js | 132 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 122 ++++++++++ ...atic-generator-method-privatename-identifier.js | 123 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 120 ++++++++++ ...-gen-rs-static-method-privatename-identifier.js | 120 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 108 +++++++++ ...ine-gen-rs-static-privatename-identifier-alt.js | 108 +++++++++ ...s-static-privatename-identifier-by-classname.js | 108 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 102 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 102 ++++++++ ...rs-static-privatename-identifier-initializer.js | 102 ++++++++ ...me-line-gen-rs-static-privatename-identifier.js | 108 +++++++++ .../after-same-line-gen-static-private-fields.js | 69 ++++++ ...-line-gen-static-private-methods-with-fields.js | 86 +++++++ .../after-same-line-gen-static-private-methods.js | 73 ++++++ .../after-same-line-gen-string-literal-names.js | 82 +++++++ .../after-same-line-method-computed-names.js | 77 ++++++ ...after-same-line-method-computed-symbol-names.js | 72 ++++++ ...privatename-identifier-semantics-stringvalue.js | 107 +++++++++ .../after-same-line-method-literal-names-asi.js | 62 +++++ .../after-same-line-method-literal-names.js | 75 ++++++ .../after-same-line-method-private-field-usage.js | 47 ++++ ...same-line-method-private-method-getter-usage.js | 47 ++++ .../after-same-line-method-private-method-usage.js | 47 ++++ .../after-same-line-method-private-names.js | 69 ++++++ ...-line-method-rs-field-identifier-initializer.js | 84 +++++++ .../after-same-line-method-rs-field-identifier.js | 91 +++++++ ...after-same-line-method-rs-private-getter-alt.js | 126 ++++++++++ .../after-same-line-method-rs-private-getter.js | 126 ++++++++++ ...after-same-line-method-rs-private-method-alt.js | 125 ++++++++++ .../after-same-line-method-rs-private-method.js | 125 ++++++++++ ...after-same-line-method-rs-private-setter-alt.js | 125 ++++++++++ .../after-same-line-method-rs-private-setter.js | 125 ++++++++++ ...me-line-method-rs-privatename-identifier-alt.js | 107 +++++++++ ...od-rs-privatename-identifier-initializer-alt.js | 101 ++++++++ ...method-rs-privatename-identifier-initializer.js | 101 ++++++++ ...r-same-line-method-rs-privatename-identifier.js | 107 +++++++++ ...-generator-method-privatename-identifier-alt.js | 131 ++++++++++ ...sync-generator-method-privatename-identifier.js | 132 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 131 ++++++++++ ...s-static-async-method-privatename-identifier.js | 132 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 122 ++++++++++ ...atic-generator-method-privatename-identifier.js | 123 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 120 ++++++++++ ...thod-rs-static-method-privatename-identifier.js | 120 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 108 +++++++++ ...-method-rs-static-privatename-identifier-alt.js | 108 +++++++++ ...s-static-privatename-identifier-by-classname.js | 108 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 102 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 102 ++++++++ ...rs-static-privatename-identifier-initializer.js | 102 ++++++++ ...line-method-rs-static-privatename-identifier.js | 108 +++++++++ ...after-same-line-method-static-private-fields.js | 69 ++++++ ...ne-method-static-private-methods-with-fields.js | 86 +++++++ ...fter-same-line-method-static-private-methods.js | 73 ++++++ .../after-same-line-method-string-literal-names.js | 82 +++++++ ...er-same-line-static-async-gen-computed-names.js | 90 +++++++ ...-line-static-async-gen-computed-symbol-names.js | 85 +++++++ ...privatename-identifier-semantics-stringvalue.js | 119 ++++++++++ ...same-line-static-async-gen-literal-names-asi.js | 75 ++++++ ...ter-same-line-static-async-gen-literal-names.js | 88 +++++++ ...me-line-static-async-gen-private-field-usage.js | 59 +++++ ...static-async-gen-private-method-getter-usage.js | 59 +++++ ...e-line-static-async-gen-private-method-usage.js | 59 +++++ ...ter-same-line-static-async-gen-private-names.js | 81 +++++++ ...ic-async-gen-rs-field-identifier-initializer.js | 97 ++++++++ ...me-line-static-async-gen-rs-field-identifier.js | 104 ++++++++ ...-line-static-async-gen-rs-private-getter-alt.js | 138 +++++++++++ ...same-line-static-async-gen-rs-private-getter.js | 138 +++++++++++ ...-line-static-async-gen-rs-private-method-alt.js | 137 +++++++++++ ...same-line-static-async-gen-rs-private-method.js | 137 +++++++++++ ...-line-static-async-gen-rs-private-setter-alt.js | 137 +++++++++++ ...same-line-static-async-gen-rs-private-setter.js | 137 +++++++++++ ...atic-async-gen-rs-privatename-identifier-alt.js | 119 ++++++++++ ...en-rs-privatename-identifier-initializer-alt.js | 113 +++++++++ ...nc-gen-rs-privatename-identifier-initializer.js | 113 +++++++++ ...e-static-async-gen-rs-privatename-identifier.js | 119 ++++++++++ ...-generator-method-privatename-identifier-alt.js | 145 ++++++++++++ ...sync-generator-method-privatename-identifier.js | 146 ++++++++++++ ...atic-async-method-privatename-identifier-alt.js | 145 ++++++++++++ ...s-static-async-method-privatename-identifier.js | 146 ++++++++++++ ...-generator-method-privatename-identifier-alt.js | 134 +++++++++++ ...atic-generator-method-privatename-identifier.js | 135 +++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 132 +++++++++++ ...-gen-rs-static-method-privatename-identifier.js | 132 +++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 120 ++++++++++ ...ync-gen-rs-static-privatename-identifier-alt.js | 120 ++++++++++ ...s-static-privatename-identifier-by-classname.js | 120 ++++++++++ ...name-identifier-initializer-alt-by-classname.js | 114 +++++++++ ...tatic-privatename-identifier-initializer-alt.js | 114 +++++++++ ...rs-static-privatename-identifier-initializer.js | 114 +++++++++ ...c-async-gen-rs-static-privatename-identifier.js | 120 ++++++++++ ...-line-static-async-gen-static-private-fields.js | 81 +++++++ ...async-gen-static-private-methods-with-fields.js | 98 ++++++++ ...line-static-async-gen-static-private-methods.js | 85 +++++++ ...e-line-static-async-gen-string-literal-names.js | 95 ++++++++ ...same-line-static-async-method-computed-names.js | 89 +++++++ ...ne-static-async-method-computed-symbol-names.js | 84 +++++++ ...privatename-identifier-semantics-stringvalue.js | 118 +++++++++ ...e-line-static-async-method-literal-names-asi.js | 74 ++++++ ...-same-line-static-async-method-literal-names.js | 87 +++++++ ...line-static-async-method-private-field-usage.js | 58 +++++ ...tic-async-method-private-method-getter-usage.js | 58 +++++ ...ine-static-async-method-private-method-usage.js | 58 +++++ ...-same-line-static-async-method-private-names.js | 80 +++++++ ...async-method-rs-field-identifier-initializer.js | 96 ++++++++ ...line-static-async-method-rs-field-identifier.js | 103 ++++++++ ...ne-static-async-method-rs-private-getter-alt.js | 137 +++++++++++ ...e-line-static-async-method-rs-private-getter.js | 137 +++++++++++ ...ne-static-async-method-rs-private-method-alt.js | 136 +++++++++++ ...e-line-static-async-method-rs-private-method.js | 136 +++++++++++ ...ne-static-async-method-rs-private-setter-alt.js | 136 +++++++++++ ...e-line-static-async-method-rs-private-setter.js | 136 +++++++++++ ...c-async-method-rs-privatename-identifier-alt.js | 118 +++++++++ ...od-rs-privatename-identifier-initializer-alt.js | 112 +++++++++ ...method-rs-privatename-identifier-initializer.js | 112 +++++++++ ...tatic-async-method-rs-privatename-identifier.js | 118 +++++++++ ...-generator-method-privatename-identifier-alt.js | 144 +++++++++++ ...sync-generator-method-privatename-identifier.js | 145 ++++++++++++ ...atic-async-method-privatename-identifier-alt.js | 144 +++++++++++ ...s-static-async-method-privatename-identifier.js | 145 ++++++++++++ ...-generator-method-privatename-identifier-alt.js | 133 +++++++++++ ...atic-generator-method-privatename-identifier.js | 134 +++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 131 ++++++++++ ...thod-rs-static-method-privatename-identifier.js | 131 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 119 ++++++++++ ...-method-rs-static-privatename-identifier-alt.js | 119 ++++++++++ ...s-static-privatename-identifier-by-classname.js | 119 ++++++++++ ...name-identifier-initializer-alt-by-classname.js | 113 +++++++++ ...tatic-privatename-identifier-initializer-alt.js | 113 +++++++++ ...rs-static-privatename-identifier-initializer.js | 113 +++++++++ ...sync-method-rs-static-privatename-identifier.js | 119 ++++++++++ ...ne-static-async-method-static-private-fields.js | 80 +++++++ ...nc-method-static-private-methods-with-fields.js | 97 ++++++++ ...e-static-async-method-static-private-methods.js | 84 +++++++ ...ine-static-async-method-string-literal-names.js | 94 ++++++++ .../after-same-line-static-gen-computed-names.js | 77 ++++++ ...r-same-line-static-gen-computed-symbol-names.js | 72 ++++++ ...privatename-identifier-semantics-stringvalue.js | 107 +++++++++ ...after-same-line-static-gen-literal-names-asi.js | 62 +++++ .../after-same-line-static-gen-literal-names.js | 75 ++++++ ...ter-same-line-static-gen-private-field-usage.js | 47 ++++ ...-line-static-gen-private-method-getter-usage.js | 47 ++++ ...er-same-line-static-gen-private-method-usage.js | 47 ++++ .../after-same-line-static-gen-private-names.js | 69 ++++++ ...e-static-gen-rs-field-identifier-initializer.js | 84 +++++++ ...ter-same-line-static-gen-rs-field-identifier.js | 91 +++++++ ...r-same-line-static-gen-rs-private-getter-alt.js | 126 ++++++++++ ...after-same-line-static-gen-rs-private-getter.js | 126 ++++++++++ ...r-same-line-static-gen-rs-private-method-alt.js | 125 ++++++++++ ...after-same-line-static-gen-rs-private-method.js | 125 ++++++++++ ...r-same-line-static-gen-rs-private-setter-alt.js | 125 ++++++++++ ...after-same-line-static-gen-rs-private-setter.js | 125 ++++++++++ ...ine-static-gen-rs-privatename-identifier-alt.js | 107 +++++++++ ...en-rs-privatename-identifier-initializer-alt.js | 101 ++++++++ ...ic-gen-rs-privatename-identifier-initializer.js | 101 ++++++++ ...me-line-static-gen-rs-privatename-identifier.js | 107 +++++++++ ...-generator-method-privatename-identifier-alt.js | 131 ++++++++++ ...sync-generator-method-privatename-identifier.js | 132 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 131 ++++++++++ ...s-static-async-method-privatename-identifier.js | 132 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 122 ++++++++++ ...atic-generator-method-privatename-identifier.js | 123 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 120 ++++++++++ ...-gen-rs-static-method-privatename-identifier.js | 120 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 108 +++++++++ ...tic-gen-rs-static-privatename-identifier-alt.js | 108 +++++++++ ...s-static-privatename-identifier-by-classname.js | 108 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 102 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 102 ++++++++ ...rs-static-privatename-identifier-initializer.js | 102 ++++++++ ...-static-gen-rs-static-privatename-identifier.js | 108 +++++++++ ...r-same-line-static-gen-static-private-fields.js | 69 ++++++ ...tatic-gen-static-private-methods-with-fields.js | 86 +++++++ ...-same-line-static-gen-static-private-methods.js | 73 ++++++ ...er-same-line-static-gen-string-literal-names.js | 82 +++++++ ...after-same-line-static-method-computed-names.js | 77 ++++++ ...ame-line-static-method-computed-symbol-names.js | 72 ++++++ ...privatename-identifier-semantics-stringvalue.js | 107 +++++++++ ...er-same-line-static-method-literal-names-asi.js | 62 +++++ .../after-same-line-static-method-literal-names.js | 75 ++++++ ...-same-line-static-method-private-field-usage.js | 47 ++++ ...ne-static-method-private-method-getter-usage.js | 47 ++++ ...same-line-static-method-private-method-usage.js | 47 ++++ .../after-same-line-static-method-private-names.js | 69 ++++++ ...tatic-method-rs-field-identifier-initializer.js | 84 +++++++ ...-same-line-static-method-rs-field-identifier.js | 91 +++++++ ...ame-line-static-method-rs-private-getter-alt.js | 126 ++++++++++ ...er-same-line-static-method-rs-private-getter.js | 126 ++++++++++ ...ame-line-static-method-rs-private-method-alt.js | 125 ++++++++++ ...er-same-line-static-method-rs-private-method.js | 125 ++++++++++ ...ame-line-static-method-rs-private-setter-alt.js | 125 ++++++++++ ...er-same-line-static-method-rs-private-setter.js | 125 ++++++++++ ...-static-method-rs-privatename-identifier-alt.js | 107 +++++++++ ...od-rs-privatename-identifier-initializer-alt.js | 101 ++++++++ ...method-rs-privatename-identifier-initializer.js | 101 ++++++++ ...line-static-method-rs-privatename-identifier.js | 107 +++++++++ ...-generator-method-privatename-identifier-alt.js | 131 ++++++++++ ...sync-generator-method-privatename-identifier.js | 132 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 131 ++++++++++ ...s-static-async-method-privatename-identifier.js | 132 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 122 ++++++++++ ...atic-generator-method-privatename-identifier.js | 123 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 120 ++++++++++ ...thod-rs-static-method-privatename-identifier.js | 120 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 108 +++++++++ ...-method-rs-static-privatename-identifier-alt.js | 108 +++++++++ ...s-static-privatename-identifier-by-classname.js | 108 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 102 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 102 ++++++++ ...rs-static-privatename-identifier-initializer.js | 102 ++++++++ ...atic-method-rs-static-privatename-identifier.js | 108 +++++++++ ...ame-line-static-method-static-private-fields.js | 69 ++++++ ...ic-method-static-private-methods-with-fields.js | 86 +++++++ ...me-line-static-method-static-private-methods.js | 73 ++++++ ...same-line-static-method-string-literal-names.js | 82 +++++++ ...ved-cls-direct-eval-contains-superproperty-1.js | 36 +++ ...ved-cls-direct-eval-contains-superproperty-2.js | 33 +++ ...ved-cls-direct-eval-err-contains-supercall-1.js | 38 +++ ...ved-cls-direct-eval-err-contains-supercall-2.js | 31 +++ ...rived-cls-direct-eval-err-contains-supercall.js | 38 +++ ...d-cls-indirect-eval-contains-superproperty-1.js | 36 +++ ...d-cls-indirect-eval-contains-superproperty-2.js | 33 +++ ...d-cls-indirect-eval-err-contains-supercall-1.js | 36 +++ ...d-cls-indirect-eval-err-contains-supercall-2.js | 29 +++ ...ved-cls-indirect-eval-err-contains-supercall.js | 36 +++ ...rrow-body-direct-eval-err-contains-arguments.js | 38 +++ ...rrow-body-direct-eval-err-contains-newtarget.js | 36 +++ ...ow-body-indirect-eval-err-contains-newtarget.js | 35 +++ ...ved-cls-direct-eval-contains-superproperty-1.js | 40 ++++ ...ved-cls-direct-eval-contains-superproperty-2.js | 37 +++ ...ved-cls-direct-eval-err-contains-supercall-1.js | 39 +++ ...ved-cls-direct-eval-err-contains-supercall-2.js | 32 +++ ...rived-cls-direct-eval-err-contains-supercall.js | 39 +++ ...d-cls-indirect-eval-contains-superproperty-1.js | 37 +++ ...d-cls-indirect-eval-contains-superproperty-2.js | 34 +++ ...d-cls-indirect-eval-err-contains-supercall-1.js | 37 +++ ...d-cls-indirect-eval-err-contains-supercall-2.js | 30 +++ ...ved-cls-indirect-eval-err-contains-supercall.js | 37 +++ ...y-private-direct-eval-err-contains-arguments.js | 39 +++ ...y-private-direct-eval-err-contains-newtarget.js | 40 ++++ ...private-indirect-eval-err-contains-newtarget.js | 36 +++ .../arrow-fnc-init-err-contains-arguments.js | 35 +++ .../elements/arrow-fnc-init-err-contains-super.js | 28 +++ .../await-as-binding-identifier-escaped.js | 37 +++ .../await-as-binding-identifier.js | 37 +++ .../await-as-identifier-reference-escaped.js | 37 +++ .../await-as-identifier-reference.js | 37 +++ .../await-as-label-identifier-escaped.js | 37 +++ .../await-as-label-identifier.js | 37 +++ .../async-gen-private-method-static/browser.js | 0 .../async-gen-private-method-static/shell.js | 0 .../yield-as-binding-identifier-escaped.js | 37 +++ .../yield-as-binding-identifier.js | 37 +++ .../yield-as-identifier-reference-escaped.js | 37 +++ .../yield-as-identifier-reference.js | 37 +++ .../yield-as-label-identifier-escaped.js | 37 +++ .../yield-as-label-identifier.js | 37 +++ .../yield-identifier-spread-strict-strict.js | 64 +++++ .../yield-identifier-strict-strict.js | 55 +++++ .../yield-promise-reject-next-catch.js | 60 +++++ ...mise-reject-next-for-await-of-async-iterator.js | 66 ++++++ ...omise-reject-next-for-await-of-sync-iterator.js | 65 +++++ ...romise-reject-next-yield-star-async-iterator.js | 64 +++++ ...promise-reject-next-yield-star-sync-iterator.js | 63 +++++ .../yield-promise-reject-next.js | 60 +++++ .../yield-spread-arr-multiple.js | 66 ++++++ .../yield-spread-arr-single.js | 65 +++++ .../yield-spread-obj.js | 68 ++++++ .../yield-star-async-next.js | 235 ++++++++++++++++++ .../yield-star-async-return.js | 251 ++++++++++++++++++++ .../yield-star-async-throw.js | 259 ++++++++++++++++++++ .../yield-star-expr-abrupt.js | 70 ++++++ .../yield-star-getiter-async-get-abrupt.js | 90 +++++++ ...tar-getiter-async-not-callable-boolean-throw.js | 89 +++++++ ...star-getiter-async-not-callable-number-throw.js | 89 +++++++ ...star-getiter-async-not-callable-object-throw.js | 89 +++++++ ...star-getiter-async-not-callable-string-throw.js | 89 +++++++ ...star-getiter-async-not-callable-symbol-throw.js | 89 +++++++ ...ield-star-getiter-async-null-sync-get-abrupt.js | 95 ++++++++ .../yield-star-getiter-async-returns-abrupt.js | 86 +++++++ ...eld-star-getiter-async-returns-boolean-throw.js | 86 +++++++ .../yield-star-getiter-async-returns-null-throw.js | 86 +++++++ ...ield-star-getiter-async-returns-number-throw.js | 86 +++++++ ...ield-star-getiter-async-returns-string-throw.js | 86 +++++++ ...ield-star-getiter-async-returns-symbol-throw.js | 86 +++++++ ...d-star-getiter-async-returns-undefined-throw.js | 86 +++++++ ...star-getiter-async-undefined-sync-get-abrupt.js | 95 ++++++++ .../yield-star-getiter-sync-get-abrupt.js | 89 +++++++ ...star-getiter-sync-not-callable-boolean-throw.js | 88 +++++++ ...-star-getiter-sync-not-callable-number-throw.js | 88 +++++++ ...-star-getiter-sync-not-callable-object-throw.js | 88 +++++++ ...-star-getiter-sync-not-callable-string-throw.js | 88 +++++++ ...-star-getiter-sync-not-callable-symbol-throw.js | 88 +++++++ .../yield-star-getiter-sync-returns-abrupt.js | 83 +++++++ ...ield-star-getiter-sync-returns-boolean-throw.js | 88 +++++++ .../yield-star-getiter-sync-returns-null-throw.js | 88 +++++++ ...yield-star-getiter-sync-returns-number-throw.js | 88 +++++++ ...yield-star-getiter-sync-returns-string-throw.js | 88 +++++++ ...yield-star-getiter-sync-returns-symbol-throw.js | 88 +++++++ ...ld-star-getiter-sync-returns-undefined-throw.js | 88 +++++++ .../yield-star-next-call-done-get-abrupt.js | 89 +++++++ .../yield-star-next-call-returns-abrupt.js | 81 +++++++ .../yield-star-next-call-value-get-abrupt.js | 91 +++++++ .../yield-star-next-get-abrupt.js | 81 +++++++ .../yield-star-next-non-object-ignores-then.js | 101 ++++++++ .../yield-star-next-not-callable-boolean-throw.js | 78 ++++++ .../yield-star-next-not-callable-null-throw.js | 78 ++++++ .../yield-star-next-not-callable-number-throw.js | 78 ++++++ .../yield-star-next-not-callable-object-throw.js | 78 ++++++ .../yield-star-next-not-callable-string-throw.js | 78 ++++++ .../yield-star-next-not-callable-symbol-throw.js | 78 ++++++ ...yield-star-next-not-callable-undefined-throw.js | 78 ++++++ .../yield-star-next-then-get-abrupt.js | 105 ++++++++ ...ext-then-non-callable-boolean-fulfillpromise.js | 99 ++++++++ ...r-next-then-non-callable-null-fulfillpromise.js | 99 ++++++++ ...next-then-non-callable-number-fulfillpromise.js | 99 ++++++++ ...next-then-non-callable-object-fulfillpromise.js | 99 ++++++++ ...next-then-non-callable-string-fulfillpromise.js | 99 ++++++++ ...next-then-non-callable-symbol-fulfillpromise.js | 99 ++++++++ ...t-then-non-callable-undefined-fulfillpromise.js | 99 ++++++++ .../yield-star-next-then-returns-abrupt.js | 105 ++++++++ .../yield-star-sync-next.js | 238 +++++++++++++++++++ .../yield-star-sync-return.js | 213 +++++++++++++++++ .../yield-star-sync-throw.js | 219 +++++++++++++++++ .../await-as-binding-identifier-escaped.js | 37 +++ .../await-as-binding-identifier.js | 37 +++ .../await-as-identifier-reference-escaped.js | 37 +++ .../await-as-identifier-reference.js | 37 +++ .../await-as-label-identifier-escaped.js | 37 +++ .../await-as-label-identifier.js | 37 +++ .../elements/async-gen-private-method/browser.js | 0 .../elements/async-gen-private-method/shell.js | 0 .../yield-as-binding-identifier-escaped.js | 37 +++ .../yield-as-binding-identifier.js | 37 +++ .../yield-as-identifier-reference-escaped.js | 37 +++ .../yield-as-identifier-reference.js | 37 +++ .../yield-as-label-identifier-escaped.js | 37 +++ .../yield-as-label-identifier.js | 37 +++ .../yield-identifier-spread-strict-strict.js | 68 ++++++ .../yield-identifier-strict-strict.js | 59 +++++ .../yield-promise-reject-next-catch.js | 64 +++++ ...mise-reject-next-for-await-of-async-iterator.js | 70 ++++++ ...omise-reject-next-for-await-of-sync-iterator.js | 69 ++++++ ...romise-reject-next-yield-star-async-iterator.js | 68 ++++++ ...promise-reject-next-yield-star-sync-iterator.js | 67 ++++++ .../yield-promise-reject-next.js | 64 +++++ .../yield-spread-arr-multiple.js | 70 ++++++ .../yield-spread-arr-single.js | 69 ++++++ .../async-gen-private-method/yield-spread-obj.js | 72 ++++++ .../yield-star-async-next.js | 239 +++++++++++++++++++ .../yield-star-async-return.js | 255 ++++++++++++++++++++ .../yield-star-async-throw.js | 263 +++++++++++++++++++++ .../yield-star-expr-abrupt.js | 74 ++++++ .../yield-star-getiter-async-get-abrupt.js | 94 ++++++++ ...tar-getiter-async-not-callable-boolean-throw.js | 93 ++++++++ ...star-getiter-async-not-callable-number-throw.js | 93 ++++++++ ...star-getiter-async-not-callable-object-throw.js | 93 ++++++++ ...star-getiter-async-not-callable-string-throw.js | 93 ++++++++ ...star-getiter-async-not-callable-symbol-throw.js | 93 ++++++++ ...ield-star-getiter-async-null-sync-get-abrupt.js | 99 ++++++++ .../yield-star-getiter-async-returns-abrupt.js | 90 +++++++ ...eld-star-getiter-async-returns-boolean-throw.js | 90 +++++++ .../yield-star-getiter-async-returns-null-throw.js | 90 +++++++ ...ield-star-getiter-async-returns-number-throw.js | 90 +++++++ ...ield-star-getiter-async-returns-string-throw.js | 90 +++++++ ...ield-star-getiter-async-returns-symbol-throw.js | 90 +++++++ ...d-star-getiter-async-returns-undefined-throw.js | 90 +++++++ ...star-getiter-async-undefined-sync-get-abrupt.js | 99 ++++++++ .../yield-star-getiter-sync-get-abrupt.js | 93 ++++++++ ...star-getiter-sync-not-callable-boolean-throw.js | 92 +++++++ ...-star-getiter-sync-not-callable-number-throw.js | 92 +++++++ ...-star-getiter-sync-not-callable-object-throw.js | 92 +++++++ ...-star-getiter-sync-not-callable-string-throw.js | 92 +++++++ ...-star-getiter-sync-not-callable-symbol-throw.js | 92 +++++++ .../yield-star-getiter-sync-returns-abrupt.js | 87 +++++++ ...ield-star-getiter-sync-returns-boolean-throw.js | 92 +++++++ .../yield-star-getiter-sync-returns-null-throw.js | 92 +++++++ ...yield-star-getiter-sync-returns-number-throw.js | 92 +++++++ ...yield-star-getiter-sync-returns-string-throw.js | 92 +++++++ ...yield-star-getiter-sync-returns-symbol-throw.js | 92 +++++++ ...ld-star-getiter-sync-returns-undefined-throw.js | 92 +++++++ .../yield-star-next-call-done-get-abrupt.js | 93 ++++++++ .../yield-star-next-call-returns-abrupt.js | 85 +++++++ .../yield-star-next-call-value-get-abrupt.js | 95 ++++++++ .../yield-star-next-get-abrupt.js | 85 +++++++ .../yield-star-next-non-object-ignores-then.js | 105 ++++++++ .../yield-star-next-not-callable-boolean-throw.js | 82 +++++++ .../yield-star-next-not-callable-null-throw.js | 82 +++++++ .../yield-star-next-not-callable-number-throw.js | 82 +++++++ .../yield-star-next-not-callable-object-throw.js | 82 +++++++ .../yield-star-next-not-callable-string-throw.js | 82 +++++++ .../yield-star-next-not-callable-symbol-throw.js | 82 +++++++ ...yield-star-next-not-callable-undefined-throw.js | 82 +++++++ .../yield-star-next-then-get-abrupt.js | 109 +++++++++ ...ext-then-non-callable-boolean-fulfillpromise.js | 103 ++++++++ ...r-next-then-non-callable-null-fulfillpromise.js | 103 ++++++++ ...next-then-non-callable-number-fulfillpromise.js | 103 ++++++++ ...next-then-non-callable-object-fulfillpromise.js | 103 ++++++++ ...next-then-non-callable-string-fulfillpromise.js | 103 ++++++++ ...next-then-non-callable-symbol-fulfillpromise.js | 103 ++++++++ ...t-then-non-callable-undefined-fulfillpromise.js | 103 ++++++++ .../yield-star-next-then-returns-abrupt.js | 109 +++++++++ .../yield-star-sync-next.js | 242 +++++++++++++++++++ .../yield-star-sync-return.js | 217 +++++++++++++++++ .../yield-star-sync-throw.js | 223 +++++++++++++++++ .../await-as-binding-identifier-escaped.js | 39 +++ .../await-as-binding-identifier.js | 39 +++ .../await-as-identifier-reference-escaped.js | 39 +++ .../await-as-identifier-reference.js | 39 +++ .../await-as-label-identifier-escaped.js | 39 +++ .../await-as-label-identifier.js | 39 +++ .../async-private-method-static/browser.js | 0 ...arrow-returns-arguments-from-parent-function.js | 44 ++++ .../returns-async-arrow-returns-newtarget.js | 43 ++++ .../returns-async-arrow.js | 43 ++++ ...function-returns-arguments-from-own-function.js | 44 ++++ .../returns-async-function-returns-newtarget.js | 43 ++++ .../returns-async-function.js | 43 ++++ .../elements/async-private-method-static/shell.js | 0 .../await-as-binding-identifier-escaped.js | 39 +++ .../await-as-binding-identifier.js | 39 +++ .../await-as-identifier-reference-escaped.js | 39 +++ .../await-as-identifier-reference.js | 39 +++ .../await-as-label-identifier-escaped.js | 39 +++ .../await-as-label-identifier.js | 39 +++ .../class/elements/async-private-method/browser.js | 0 ...arrow-returns-arguments-from-parent-function.js | 45 ++++ .../returns-async-arrow-returns-newtarget.js | 44 ++++ .../async-private-method/returns-async-arrow.js | 44 ++++ ...function-returns-arguments-from-own-function.js | 45 ++++ .../returns-async-function-returns-newtarget.js | 44 ++++ .../async-private-method/returns-async-function.js | 44 ++++ .../class/elements/async-private-method/shell.js | 0 .../language/expressions/class/elements/browser.js | 0 .../class-name-static-initializer-anonymous.js | 28 +++ .../elements/class-name-static-initializer-decl.js | 28 +++ ...class-name-static-initializer-default-export.js | 30 +++ .../elements/class-name-static-initializer-expr.js | 28 +++ .../comp-name-init-err-contains-arguments.js | 36 +++ .../elements/comp-name-init-err-contains-super.js | 29 +++ .../elements/computed-name-toprimitive-symbol.js | 105 ++++++++ .../class/elements/computed-name-toprimitive.js | 102 ++++++++ .../elements/ctor-called-after-fields-init.js | 35 +++ ...ved-cls-direct-eval-contains-superproperty-1.js | 36 +++ ...ved-cls-direct-eval-contains-superproperty-2.js | 33 +++ ...ved-cls-direct-eval-err-contains-supercall-1.js | 38 +++ ...ved-cls-direct-eval-err-contains-supercall-2.js | 31 +++ ...rived-cls-direct-eval-err-contains-supercall.js | 38 +++ ...d-cls-indirect-eval-contains-superproperty-1.js | 38 +++ ...d-cls-indirect-eval-contains-superproperty-2.js | 35 +++ ...d-cls-indirect-eval-err-contains-supercall-1.js | 38 +++ ...d-cls-indirect-eval-err-contains-supercall-2.js | 31 +++ ...ved-cls-indirect-eval-err-contains-supercall.js | 38 +++ .../elements/direct-eval-err-contains-arguments.js | 38 +++ .../elements/direct-eval-err-contains-newtarget.js | 36 +++ .../equality-init-err-contains-arguments.js | 35 +++ .../elements/equality-init-err-contains-super.js | 28 +++ .../class/elements/evaluation-error/browser.js | 0 .../computed-name-referenceerror.js | 58 +++++ .../computed-name-toprimitive-err.js | 60 +++++ ...omputed-name-toprimitive-returns-noncallable.js | 59 +++++ .../computed-name-toprimitive-returns-nonobject.js | 58 +++++ .../evaluation-error/computed-name-tostring-err.js | 61 +++++ .../evaluation-error/computed-name-valueof-err.js | 61 +++++ .../class/elements/evaluation-error/shell.js | 0 .../class/elements/field-declaration.js | 99 ++++++++ .../elements/fields-anonymous-function-length.js | 49 ++++ .../expressions/class/elements/fields-asi-1.js | 21 ++ .../expressions/class/elements/fields-asi-2.js | 19 ++ .../expressions/class/elements/fields-asi-3.js | 19 ++ .../expressions/class/elements/fields-asi-4.js | 19 ++ .../expressions/class/elements/fields-asi-5.js | 30 +++ .../class/elements/fields-asi-same-line-1.js | 18 ++ .../class/elements/fields-asi-same-line-2.js | 18 ++ ...elds-computed-name-static-propname-prototype.js | 34 +++ .../elements/fields-duplicate-privatenames.js | 25 ++ .../fields-literal-name-propname-constructor.js | 30 +++ ...lds-literal-name-static-propname-constructor.js | 30 +++ ...ields-literal-name-static-propname-prototype.js | 30 +++ ...ple-definitions-static-private-methods-proxy.js | 42 ++++ .../elements/fields-run-once-on-double-super.js | 43 ++++ .../fields-string-name-propname-constructor.js | 31 +++ ...elds-string-name-static-propname-constructor.js | 31 +++ ...fields-string-name-static-propname-prototype.js | 31 +++ .../elements/gen-private-method-static/browser.js | 0 .../elements/gen-private-method-static/shell.js | 0 .../yield-as-binding-identifier-escaped.js | 36 +++ .../yield-as-binding-identifier.js | 36 +++ .../yield-as-identifier-reference-escaped.js | 36 +++ .../yield-as-identifier-reference.js | 36 +++ .../yield-as-label-identifier-escaped.js | 36 +++ .../yield-as-label-identifier.js | 36 +++ .../yield-identifier-spread-strict-strict.js | 63 +++++ .../yield-identifier-strict-strict.js | 54 +++++ .../yield-spread-arr-multiple.js | 62 +++++ .../yield-spread-arr-single.js | 64 +++++ .../gen-private-method-static/yield-spread-obj.js | 67 ++++++ .../class/elements/gen-private-method/browser.js | 0 .../class/elements/gen-private-method/shell.js | 0 .../yield-as-binding-identifier-escaped.js | 36 +++ .../yield-as-binding-identifier.js | 36 +++ .../yield-as-identifier-reference-escaped.js | 36 +++ .../yield-as-identifier-reference.js | 36 +++ .../yield-as-label-identifier-escaped.js | 36 +++ .../yield-as-label-identifier.js | 36 +++ .../yield-identifier-spread-strict-strict.js | 67 ++++++ .../yield-identifier-strict-strict.js | 58 +++++ .../yield-spread-arr-multiple.js | 66 ++++++ .../gen-private-method/yield-spread-arr-single.js | 68 ++++++ .../gen-private-method/yield-spread-obj.js | 71 ++++++ .../grammar-private-field-optional-chaining.js | 43 ++++ .../elements/indirect-eval-contains-arguments.js | 24 ++ .../indirect-eval-err-contains-newtarget.js | 37 +++ .../class/elements/init-err-evaluation.js | 38 +++ .../elements/init-value-defined-after-class.js | 50 ++++ .../class/elements/init-value-incremental.js | 70 ++++++ ...tercalated-static-non-static-computed-fields.js | 78 ++++++ .../literal-name-init-err-contains-arguments.js | 35 +++ .../literal-name-init-err-contains-super.js | 28 +++ .../multiple-definitions-computed-names.js | 113 +++++++++ .../multiple-definitions-computed-symbol-names.js | 108 +++++++++ ...privatename-identifier-semantics-stringvalue.js | 143 +++++++++++ .../multiple-definitions-literal-names-asi.js | 98 ++++++++ .../elements/multiple-definitions-literal-names.js | 111 +++++++++ .../multiple-definitions-private-field-usage.js | 83 +++++++ ...iple-definitions-private-method-getter-usage.js | 83 +++++++ .../multiple-definitions-private-method-usage.js | 83 +++++++ .../elements/multiple-definitions-private-names.js | 105 ++++++++ ...-definitions-rs-field-identifier-initializer.js | 120 ++++++++++ .../multiple-definitions-rs-field-identifier.js | 127 ++++++++++ .../multiple-definitions-rs-private-getter-alt.js | 162 +++++++++++++ .../multiple-definitions-rs-private-getter.js | 162 +++++++++++++ .../multiple-definitions-rs-private-method-alt.js | 161 +++++++++++++ .../multiple-definitions-rs-private-method.js | 161 +++++++++++++ .../multiple-definitions-rs-private-setter-alt.js | 161 +++++++++++++ .../multiple-definitions-rs-private-setter.js | 161 +++++++++++++ ...le-definitions-rs-privatename-identifier-alt.js | 143 +++++++++++ ...ns-rs-privatename-identifier-initializer-alt.js | 137 +++++++++++ ...itions-rs-privatename-identifier-initializer.js | 137 +++++++++++ ...ltiple-definitions-rs-privatename-identifier.js | 143 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 167 +++++++++++++ ...sync-generator-method-privatename-identifier.js | 168 +++++++++++++ ...atic-async-method-privatename-identifier-alt.js | 167 +++++++++++++ ...s-static-async-method-privatename-identifier.js | 168 +++++++++++++ ...-generator-method-privatename-identifier-alt.js | 158 +++++++++++++ ...atic-generator-method-privatename-identifier.js | 159 +++++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 156 ++++++++++++ ...ions-rs-static-method-privatename-identifier.js | 156 ++++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 144 +++++++++++ ...nitions-rs-static-privatename-identifier-alt.js | 144 +++++++++++ ...s-static-privatename-identifier-by-classname.js | 144 +++++++++++ ...name-identifier-initializer-alt-by-classname.js | 138 +++++++++++ ...tatic-privatename-identifier-initializer-alt.js | 138 +++++++++++ ...rs-static-privatename-identifier-initializer.js | 138 +++++++++++ ...definitions-rs-static-privatename-identifier.js | 144 +++++++++++ .../multiple-definitions-static-private-fields.js | 105 ++++++++ ...finitions-static-private-methods-with-fields.js | 122 ++++++++++ .../multiple-definitions-static-private-methods.js | 109 +++++++++ .../multiple-definitions-string-literal-names.js | 118 +++++++++ .../multiple-stacked-definitions-computed-names.js | 91 +++++++ ...le-stacked-definitions-computed-symbol-names.js | 86 +++++++ ...privatename-identifier-semantics-stringvalue.js | 121 ++++++++++ ...ltiple-stacked-definitions-literal-names-asi.js | 76 ++++++ .../multiple-stacked-definitions-literal-names.js | 89 +++++++ ...iple-stacked-definitions-private-field-usage.js | 61 +++++ ...cked-definitions-private-method-getter-usage.js | 61 +++++ ...ple-stacked-definitions-private-method-usage.js | 61 +++++ .../multiple-stacked-definitions-private-names.js | 83 +++++++ ...-definitions-rs-field-identifier-initializer.js | 98 ++++++++ ...iple-stacked-definitions-rs-field-identifier.js | 105 ++++++++ ...le-stacked-definitions-rs-private-getter-alt.js | 140 +++++++++++ ...ltiple-stacked-definitions-rs-private-getter.js | 140 +++++++++++ ...le-stacked-definitions-rs-private-method-alt.js | 139 +++++++++++ ...ltiple-stacked-definitions-rs-private-method.js | 139 +++++++++++ ...le-stacked-definitions-rs-private-setter-alt.js | 139 +++++++++++ ...ltiple-stacked-definitions-rs-private-setter.js | 139 +++++++++++ ...ed-definitions-rs-privatename-identifier-alt.js | 121 ++++++++++ ...ns-rs-privatename-identifier-initializer-alt.js | 115 +++++++++ ...itions-rs-privatename-identifier-initializer.js | 115 +++++++++ ...tacked-definitions-rs-privatename-identifier.js | 121 ++++++++++ ...-generator-method-privatename-identifier-alt.js | 145 ++++++++++++ ...sync-generator-method-privatename-identifier.js | 146 ++++++++++++ ...atic-async-method-privatename-identifier-alt.js | 145 ++++++++++++ ...s-static-async-method-privatename-identifier.js | 146 ++++++++++++ ...-generator-method-privatename-identifier-alt.js | 136 +++++++++++ ...atic-generator-method-privatename-identifier.js | 137 +++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 134 +++++++++++ ...ions-rs-static-method-privatename-identifier.js | 134 +++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 122 ++++++++++ ...nitions-rs-static-privatename-identifier-alt.js | 122 ++++++++++ ...s-static-privatename-identifier-by-classname.js | 122 ++++++++++ ...name-identifier-initializer-alt-by-classname.js | 116 +++++++++ ...tatic-privatename-identifier-initializer-alt.js | 116 +++++++++ ...rs-static-privatename-identifier-initializer.js | 116 +++++++++ ...definitions-rs-static-privatename-identifier.js | 122 ++++++++++ ...le-stacked-definitions-static-private-fields.js | 83 +++++++ ...finitions-static-private-methods-with-fields.js | 100 ++++++++ ...e-stacked-definitions-static-private-methods.js | 87 +++++++ ...ple-stacked-definitions-string-literal-names.js | 96 ++++++++ ...nested-arrow-fnc-init-err-contains-arguments.js | 37 +++ .../nested-arrow-fnc-init-err-contains-super.js | 30 +++ ...nested-comp-name-init-err-contains-arguments.js | 35 +++ .../nested-comp-name-init-err-contains-super.js | 28 +++ ...ved-cls-direct-eval-contains-superproperty-1.js | 36 +++ ...ved-cls-direct-eval-contains-superproperty-2.js | 33 +++ ...ved-cls-direct-eval-err-contains-supercall-1.js | 38 +++ ...ved-cls-direct-eval-err-contains-supercall-2.js | 31 +++ ...rived-cls-direct-eval-err-contains-supercall.js | 38 +++ ...d-cls-indirect-eval-contains-superproperty-1.js | 38 +++ ...d-cls-indirect-eval-contains-superproperty-2.js | 35 +++ ...d-cls-indirect-eval-err-contains-supercall-1.js | 38 +++ ...d-cls-indirect-eval-err-contains-supercall-2.js | 31 +++ ...ved-cls-indirect-eval-err-contains-supercall.js | 38 +++ .../nested-direct-eval-err-contains-arguments.js | 41 ++++ .../nested-direct-eval-err-contains-newtarget.js | 36 +++ .../nested-equality-init-err-contains-arguments.js | 34 +++ .../nested-equality-init-err-contains-super.js | 27 +++ .../nested-indirect-eval-contains-arguments.js | 23 ++ .../nested-indirect-eval-err-contains-newtarget.js | 37 +++ ...ted-literal-name-init-err-contains-arguments.js | 34 +++ .../nested-literal-name-init-err-contains-super.js | 27 +++ ...rivate-arrow-fnc-init-err-contains-arguments.js | 37 +++ ...ed-private-arrow-fnc-init-err-contains-super.js | 30 +++ ...ved-cls-direct-eval-contains-superproperty-1.js | 37 +++ ...ved-cls-direct-eval-contains-superproperty-2.js | 34 +++ ...ved-cls-direct-eval-err-contains-supercall-1.js | 39 +++ ...ved-cls-direct-eval-err-contains-supercall-2.js | 32 +++ ...rived-cls-direct-eval-err-contains-supercall.js | 39 +++ ...d-cls-indirect-eval-contains-superproperty-1.js | 39 +++ ...d-cls-indirect-eval-contains-superproperty-2.js | 36 +++ ...d-cls-indirect-eval-err-contains-supercall-1.js | 39 +++ ...d-cls-indirect-eval-err-contains-supercall-2.js | 32 +++ ...ved-cls-indirect-eval-err-contains-supercall.js | 39 +++ ...d-private-direct-eval-err-contains-arguments.js | 42 ++++ ...d-private-direct-eval-err-contains-newtarget.js | 37 +++ ...ted-private-indirect-eval-contains-arguments.js | 27 +++ ...private-indirect-eval-err-contains-newtarget.js | 38 +++ ...ate-literal-name-init-err-contains-arguments.js | 34 +++ ...private-literal-name-init-err-contains-super.js | 27 +++ ...-private-ternary-init-err-contains-arguments.js | 34 +++ ...sted-private-ternary-init-err-contains-super.js | 27 +++ ...d-private-typeof-init-err-contains-arguments.js | 34 +++ ...ested-private-typeof-init-err-contains-super.js | 27 +++ ...static-comp-name-init-err-contains-arguments.js | 35 +++ ...ted-static-comp-name-init-err-contains-super.js | 28 +++ ...d-static-literal-init-err-contains-arguments.js | 34 +++ ...ested-static-literal-init-err-contains-super.js | 27 +++ ...d-static-private-init-err-contains-arguments.js | 34 +++ ...ested-static-private-init-err-contains-super.js | 27 +++ ...ing-literal-name-init-err-contains-arguments.js | 34 +++ ...-string-literal-name-init-err-contains-super.js | 27 +++ ...ing-literal-name-init-err-contains-arguments.js | 34 +++ ...-string-literal-name-init-err-contains-super.js | 27 +++ .../nested-ternary-init-err-contains-arguments.js | 34 +++ .../nested-ternary-init-err-contains-super.js | 27 +++ .../nested-typeof-init-err-contains-arguments.js | 34 +++ .../nested-typeof-init-err-contains-super.js | 27 +++ .../new-no-sc-line-method-computed-names.js | 78 ++++++ .../new-no-sc-line-method-computed-symbol-names.js | 73 ++++++ ...privatename-identifier-semantics-stringvalue.js | 108 +++++++++ .../new-no-sc-line-method-literal-names-asi.js | 63 +++++ .../new-no-sc-line-method-literal-names.js | 76 ++++++ .../new-no-sc-line-method-private-field-usage.js | 48 ++++ ...o-sc-line-method-private-method-getter-usage.js | 48 ++++ .../new-no-sc-line-method-private-method-usage.js | 48 ++++ .../new-no-sc-line-method-private-names.js | 70 ++++++ ...-line-method-rs-field-identifier-initializer.js | 85 +++++++ .../new-no-sc-line-method-rs-field-identifier.js | 92 +++++++ .../new-no-sc-line-method-rs-private-getter-alt.js | 127 ++++++++++ .../new-no-sc-line-method-rs-private-getter.js | 127 ++++++++++ .../new-no-sc-line-method-rs-private-method-alt.js | 126 ++++++++++ .../new-no-sc-line-method-rs-private-method.js | 126 ++++++++++ .../new-no-sc-line-method-rs-private-setter-alt.js | 126 ++++++++++ .../new-no-sc-line-method-rs-private-setter.js | 126 ++++++++++ ...sc-line-method-rs-privatename-identifier-alt.js | 108 +++++++++ ...od-rs-privatename-identifier-initializer-alt.js | 102 ++++++++ ...method-rs-privatename-identifier-initializer.js | 102 ++++++++ ...-no-sc-line-method-rs-privatename-identifier.js | 108 +++++++++ ...-generator-method-privatename-identifier-alt.js | 132 +++++++++++ ...sync-generator-method-privatename-identifier.js | 133 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 132 +++++++++++ ...s-static-async-method-privatename-identifier.js | 133 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 123 ++++++++++ ...atic-generator-method-privatename-identifier.js | 124 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 121 ++++++++++ ...thod-rs-static-method-privatename-identifier.js | 121 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 109 +++++++++ ...-method-rs-static-privatename-identifier-alt.js | 109 +++++++++ ...s-static-privatename-identifier-by-classname.js | 109 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 103 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 103 ++++++++ ...rs-static-privatename-identifier-initializer.js | 103 ++++++++ ...line-method-rs-static-privatename-identifier.js | 109 +++++++++ .../new-no-sc-line-method-static-private-fields.js | 70 ++++++ ...ne-method-static-private-methods-with-fields.js | 87 +++++++ ...new-no-sc-line-method-static-private-methods.js | 74 ++++++ .../new-no-sc-line-method-string-literal-names.js | 83 +++++++ .../elements/new-sc-line-gen-computed-names.js | 78 ++++++ .../new-sc-line-gen-computed-symbol-names.js | 73 ++++++ ...privatename-identifier-semantics-stringvalue.js | 108 +++++++++ .../elements/new-sc-line-gen-literal-names-asi.js | 63 +++++ .../elements/new-sc-line-gen-literal-names.js | 76 ++++++ .../new-sc-line-gen-private-field-usage.js | 48 ++++ .../new-sc-line-gen-private-method-getter-usage.js | 48 ++++ .../new-sc-line-gen-private-method-usage.js | 48 ++++ .../elements/new-sc-line-gen-private-names.js | 70 ++++++ ...-sc-line-gen-rs-field-identifier-initializer.js | 85 +++++++ .../new-sc-line-gen-rs-field-identifier.js | 92 +++++++ .../new-sc-line-gen-rs-private-getter-alt.js | 127 ++++++++++ .../elements/new-sc-line-gen-rs-private-getter.js | 127 ++++++++++ .../new-sc-line-gen-rs-private-method-alt.js | 126 ++++++++++ .../elements/new-sc-line-gen-rs-private-method.js | 126 ++++++++++ .../new-sc-line-gen-rs-private-setter-alt.js | 126 ++++++++++ .../elements/new-sc-line-gen-rs-private-setter.js | 126 ++++++++++ ...ew-sc-line-gen-rs-privatename-identifier-alt.js | 108 +++++++++ ...en-rs-privatename-identifier-initializer-alt.js | 102 ++++++++ ...ne-gen-rs-privatename-identifier-initializer.js | 102 ++++++++ .../new-sc-line-gen-rs-privatename-identifier.js | 108 +++++++++ ...-generator-method-privatename-identifier-alt.js | 132 +++++++++++ ...sync-generator-method-privatename-identifier.js | 133 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 132 +++++++++++ ...s-static-async-method-privatename-identifier.js | 133 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 123 ++++++++++ ...atic-generator-method-privatename-identifier.js | 124 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 121 ++++++++++ ...-gen-rs-static-method-privatename-identifier.js | 121 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 109 +++++++++ ...ine-gen-rs-static-privatename-identifier-alt.js | 109 +++++++++ ...s-static-privatename-identifier-by-classname.js | 109 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 103 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 103 ++++++++ ...rs-static-privatename-identifier-initializer.js | 103 ++++++++ ...sc-line-gen-rs-static-privatename-identifier.js | 109 +++++++++ .../new-sc-line-gen-static-private-fields.js | 70 ++++++ ...-line-gen-static-private-methods-with-fields.js | 87 +++++++ .../new-sc-line-gen-static-private-methods.js | 74 ++++++ .../new-sc-line-gen-string-literal-names.js | 83 +++++++ .../elements/new-sc-line-method-computed-names.js | 78 ++++++ .../new-sc-line-method-computed-symbol-names.js | 73 ++++++ ...privatename-identifier-semantics-stringvalue.js | 108 +++++++++ .../new-sc-line-method-literal-names-asi.js | 63 +++++ .../elements/new-sc-line-method-literal-names.js | 76 ++++++ .../new-sc-line-method-private-field-usage.js | 48 ++++ ...w-sc-line-method-private-method-getter-usage.js | 48 ++++ .../new-sc-line-method-private-method-usage.js | 48 ++++ .../elements/new-sc-line-method-private-names.js | 70 ++++++ ...-line-method-rs-field-identifier-initializer.js | 85 +++++++ .../new-sc-line-method-rs-field-identifier.js | 92 +++++++ .../new-sc-line-method-rs-private-getter-alt.js | 127 ++++++++++ .../new-sc-line-method-rs-private-getter.js | 127 ++++++++++ .../new-sc-line-method-rs-private-method-alt.js | 126 ++++++++++ .../new-sc-line-method-rs-private-method.js | 126 ++++++++++ .../new-sc-line-method-rs-private-setter-alt.js | 126 ++++++++++ .../new-sc-line-method-rs-private-setter.js | 126 ++++++++++ ...sc-line-method-rs-privatename-identifier-alt.js | 108 +++++++++ ...od-rs-privatename-identifier-initializer-alt.js | 102 ++++++++ ...method-rs-privatename-identifier-initializer.js | 102 ++++++++ ...new-sc-line-method-rs-privatename-identifier.js | 108 +++++++++ ...-generator-method-privatename-identifier-alt.js | 132 +++++++++++ ...sync-generator-method-privatename-identifier.js | 133 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 132 +++++++++++ ...s-static-async-method-privatename-identifier.js | 133 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 123 ++++++++++ ...atic-generator-method-privatename-identifier.js | 124 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 121 ++++++++++ ...thod-rs-static-method-privatename-identifier.js | 121 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 109 +++++++++ ...-method-rs-static-privatename-identifier-alt.js | 109 +++++++++ ...s-static-privatename-identifier-by-classname.js | 109 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 103 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 103 ++++++++ ...rs-static-privatename-identifier-initializer.js | 103 ++++++++ ...line-method-rs-static-privatename-identifier.js | 109 +++++++++ .../new-sc-line-method-static-private-fields.js | 70 ++++++ ...ne-method-static-private-methods-with-fields.js | 87 +++++++ .../new-sc-line-method-static-private-methods.js | 74 ++++++ .../new-sc-line-method-string-literal-names.js | 83 +++++++ .../elements/private-accessor-name/browser.js | 0 .../inst-private-escape-sequence-ZWJ.js | 81 +++++++ .../inst-private-escape-sequence-ZWNJ.js | 81 +++++++ .../inst-private-escape-sequence-u2118.js | 81 +++++++ .../inst-private-escape-sequence-u6F.js | 81 +++++++ .../private-accessor-name/inst-private-name-ZWJ.js | 81 +++++++ .../inst-private-name-ZWNJ.js | 81 +++++++ .../inst-private-name-common.js | 81 +++++++ .../inst-private-name-dollar.js | 81 +++++++ .../inst-private-name-u2118.js | 81 +++++++ .../inst-private-name-underscore.js | 81 +++++++ .../class/elements/private-accessor-name/shell.js | 0 .../static-private-escape-sequence-ZWJ.js | 81 +++++++ .../static-private-escape-sequence-ZWNJ.js | 81 +++++++ .../static-private-escape-sequence-u2118.js | 81 +++++++ .../static-private-escape-sequence-u6F.js | 81 +++++++ .../static-private-name-ZWJ.js | 81 +++++++ .../static-private-name-ZWNJ.js | 81 +++++++ .../static-private-name-common.js | 81 +++++++ .../static-private-name-dollar.js | 81 +++++++ .../static-private-name-u2118.js | 81 +++++++ .../static-private-name-underscore.js | 81 +++++++ ...rivate-arrow-fnc-init-err-contains-arguments.js | 35 +++ .../private-arrow-fnc-init-err-contains-super.js | 28 +++ .../private-async-generator-method-name.js | 62 +++++ .../class/elements/private-async-method-name.js | 62 +++++ ...ved-cls-direct-eval-contains-superproperty-1.js | 37 +++ ...ved-cls-direct-eval-contains-superproperty-2.js | 34 +++ ...ved-cls-direct-eval-err-contains-supercall-1.js | 39 +++ ...ved-cls-direct-eval-err-contains-supercall-2.js | 32 +++ ...rived-cls-direct-eval-err-contains-supercall.js | 39 +++ ...d-cls-indirect-eval-contains-superproperty-1.js | 39 +++ ...d-cls-indirect-eval-contains-superproperty-2.js | 36 +++ ...d-cls-indirect-eval-err-contains-supercall-1.js | 39 +++ ...d-cls-indirect-eval-err-contains-supercall-2.js | 32 +++ ...ved-cls-indirect-eval-err-contains-supercall.js | 39 +++ .../private-direct-eval-err-contains-arguments.js | 39 +++ .../private-direct-eval-err-contains-newtarget.js | 37 +++ ...private-field-access-on-inner-arrow-function.js | 44 ++++ .../private-field-access-on-inner-function.js | 45 ++++ .../elements/private-field-after-optional-chain.js | 47 ++++ .../elements/private-field-as-arrow-function.js | 36 +++ .../private-field-as-async-arrow-function.js | 37 +++ .../elements/private-field-as-async-function.js | 37 +++ .../class/elements/private-field-as-function.js | 36 +++ .../elements/private-field-on-nested-class.js | 48 ++++ .../private-fields-proxy-default-handler-throws.js | 33 +++ .../elements/private-generator-method-name.js | 62 +++++ ...rivate-getter-access-on-inner-arrow-function.js | 44 ++++ .../private-getter-access-on-inner-function.js | 45 ++++ .../private-getter-is-not-a-own-property.js | 48 ++++ .../elements/private-getter-on-nested-class.js | 39 +++ ...ate-getter-shadowed-by-field-on-nested-class.js | 47 ++++ ...te-getter-shadowed-by-getter-on-nested-class.js | 47 ++++ ...te-getter-shadowed-by-method-on-nested-class.js | 44 ++++ ...te-getter-shadowed-by-setter-on-nested-class.js | 52 ++++ .../private-indirect-eval-contains-arguments.js | 27 +++ ...private-indirect-eval-err-contains-newtarget.js | 38 +++ ...ate-literal-name-init-err-contains-arguments.js | 35 +++ ...private-literal-name-init-err-contains-super.js | 28 +++ ...rivate-method-access-on-inner-arrow-function.js | 44 ++++ .../private-method-access-on-inner-function.js | 45 ++++ .../class/elements/private-method-comparison.js | 48 ++++ .../class/elements/private-method-get-and-call.js | 50 ++++ .../private-method-is-not-a-own-property.js | 46 ++++ .../class/elements/private-method-length.js | 50 ++++ .../elements/private-method-on-nested-class.js | 39 +++ ...private-method-referenced-from-static-method.js | 41 ++++ ...ate-method-shadowed-by-field-on-nested-class.js | 47 ++++ ...te-method-shadowed-by-getter-on-nested-class.js | 50 ++++ ...te-method-shadowed-by-setter-on-nested-class.js | 52 ++++ .../private-method-shadowed-on-nested-class.js | 41 ++++ .../class/elements/private-methods/browser.js | 0 .../prod-private-async-generator.js | 135 +++++++++++ .../private-methods/prod-private-async-method.js | 130 ++++++++++ .../private-methods/prod-private-generator.js | 128 ++++++++++ .../prod-private-method-initialize-order.js | 143 +++++++++++ .../private-methods/prod-private-method.js | 124 ++++++++++ .../class/elements/private-methods/shell.js | 0 ...rivate-setter-access-on-inner-arrow-function.js | 45 ++++ .../private-setter-access-on-inner-function.js | 46 ++++ .../private-setter-is-not-a-own-property.js | 49 ++++ .../elements/private-setter-on-nested-class.js | 40 ++++ ...ate-setter-shadowed-by-field-on-nested-class.js | 54 +++++ ...te-setter-shadowed-by-getter-on-nested-class.js | 53 +++++ ...te-setter-shadowed-by-method-on-nested-class.js | 53 +++++ ...te-setter-shadowed-by-setter-on-nested-class.js | 52 ++++ .../private-static-async-generator-method-name.js | 63 +++++ .../elements/private-static-async-method-name.js | 63 +++++ ...atic-field-shadowed-by-field-on-nested-class.js | 92 +++++++ ...tic-field-shadowed-by-getter-on-nested-class.js | 93 ++++++++ ...tic-field-shadowed-by-method-on-nested-class.js | 93 ++++++++ ...tic-field-shadowed-by-setter-on-nested-class.js | 94 ++++++++ ...ivate-static-field-usage-inside-nested-class.js | 82 +++++++ .../private-static-generator-method-name.js | 63 +++++ .../class/elements/private-static-method-length.js | 49 ++++ .../class/elements/private-static-method-name.js | 74 ++++++ ...tic-method-shadowed-by-field-on-nested-class.js | 92 +++++++ ...ic-method-shadowed-by-getter-on-nested-class.js | 93 ++++++++ ...ic-method-shadowed-by-method-on-nested-class.js | 93 ++++++++ ...ic-method-shadowed-by-setter-on-nested-class.js | 94 ++++++++ ...vate-static-method-usage-inside-nested-class.js | 84 +++++++ .../private-ternary-init-err-contains-arguments.js | 35 +++ .../private-ternary-init-err-contains-super.js | 28 +++ .../private-typeof-init-err-contains-arguments.js | 35 +++ .../private-typeof-init-err-contains-super.js | 28 +++ ...te-getter-before-super-return-in-constructor.js | 49 ++++ ...ter-before-super-return-in-field-initializer.js | 47 ++++ ...te-method-before-super-return-in-constructor.js | 49 ++++ ...hod-before-super-return-in-field-initializer.js | 47 ++++ ...te-setter-before-super-return-in-constructor.js | 49 ++++ ...ter-before-super-return-in-field-initializer.js | 47 ++++ .../class/elements/redeclaration-symbol.js | 57 +++++ .../expressions/class/elements/redeclaration.js | 57 +++++ .../elements/regular-definitions-computed-names.js | 67 ++++++ .../regular-definitions-computed-symbol-names.js | 62 +++++ ...privatename-identifier-semantics-stringvalue.js | 96 ++++++++ .../regular-definitions-literal-names-asi.js | 52 ++++ .../elements/regular-definitions-literal-names.js | 65 +++++ .../regular-definitions-private-field-usage.js | 36 +++ ...ular-definitions-private-method-getter-usage.js | 36 +++ .../regular-definitions-private-method-usage.js | 36 +++ .../elements/regular-definitions-private-names.js | 58 +++++ ...-definitions-rs-field-identifier-initializer.js | 73 ++++++ .../regular-definitions-rs-field-identifier.js | 80 +++++++ .../regular-definitions-rs-private-getter-alt.js | 115 +++++++++ .../regular-definitions-rs-private-getter.js | 115 +++++++++ .../regular-definitions-rs-private-method-alt.js | 114 +++++++++ .../regular-definitions-rs-private-method.js | 114 +++++++++ .../regular-definitions-rs-private-setter-alt.js | 114 +++++++++ .../regular-definitions-rs-private-setter.js | 114 +++++++++ ...ar-definitions-rs-privatename-identifier-alt.js | 96 ++++++++ ...ns-rs-privatename-identifier-initializer-alt.js | 90 +++++++ ...itions-rs-privatename-identifier-initializer.js | 90 +++++++ ...egular-definitions-rs-privatename-identifier.js | 96 ++++++++ ...-generator-method-privatename-identifier-alt.js | 120 ++++++++++ ...sync-generator-method-privatename-identifier.js | 121 ++++++++++ ...atic-async-method-privatename-identifier-alt.js | 120 ++++++++++ ...s-static-async-method-privatename-identifier.js | 121 ++++++++++ ...-generator-method-privatename-identifier-alt.js | 111 +++++++++ ...atic-generator-method-privatename-identifier.js | 112 +++++++++ ...-rs-static-method-privatename-identifier-alt.js | 109 +++++++++ ...ions-rs-static-method-privatename-identifier.js | 109 +++++++++ ...atic-privatename-identifier-alt-by-classname.js | 97 ++++++++ ...nitions-rs-static-privatename-identifier-alt.js | 97 ++++++++ ...s-static-privatename-identifier-by-classname.js | 97 ++++++++ ...name-identifier-initializer-alt-by-classname.js | 91 +++++++ ...tatic-privatename-identifier-initializer-alt.js | 91 +++++++ ...rs-static-privatename-identifier-initializer.js | 91 +++++++ ...definitions-rs-static-privatename-identifier.js | 97 ++++++++ .../regular-definitions-static-private-fields.js | 58 +++++ ...finitions-static-private-methods-with-fields.js | 75 ++++++ .../regular-definitions-static-private-methods.js | 62 +++++ .../regular-definitions-string-literal-names.js | 72 ++++++ .../elements/same-line-async-gen-computed-names.js | 90 +++++++ .../same-line-async-gen-computed-symbol-names.js | 85 +++++++ ...privatename-identifier-semantics-stringvalue.js | 119 ++++++++++ .../same-line-async-gen-literal-names-asi.js | 75 ++++++ .../elements/same-line-async-gen-literal-names.js | 88 +++++++ .../same-line-async-gen-private-field-usage.js | 59 +++++ ...e-line-async-gen-private-method-getter-usage.js | 59 +++++ .../same-line-async-gen-private-method-usage.js | 59 +++++ .../elements/same-line-async-gen-private-names.js | 81 +++++++ ...ne-async-gen-rs-field-identifier-initializer.js | 97 ++++++++ .../same-line-async-gen-rs-field-identifier.js | 104 ++++++++ .../same-line-async-gen-rs-private-getter-alt.js | 138 +++++++++++ .../same-line-async-gen-rs-private-getter.js | 138 +++++++++++ .../same-line-async-gen-rs-private-method-alt.js | 137 +++++++++++ .../same-line-async-gen-rs-private-method.js | 137 +++++++++++ .../same-line-async-gen-rs-private-setter-alt.js | 137 +++++++++++ .../same-line-async-gen-rs-private-setter.js | 137 +++++++++++ ...line-async-gen-rs-privatename-identifier-alt.js | 119 ++++++++++ ...en-rs-privatename-identifier-initializer-alt.js | 113 +++++++++ ...nc-gen-rs-privatename-identifier-initializer.js | 113 +++++++++ ...ame-line-async-gen-rs-privatename-identifier.js | 119 ++++++++++ ...-generator-method-privatename-identifier-alt.js | 145 ++++++++++++ ...sync-generator-method-privatename-identifier.js | 146 ++++++++++++ ...atic-async-method-privatename-identifier-alt.js | 145 ++++++++++++ ...s-static-async-method-privatename-identifier.js | 146 ++++++++++++ ...-generator-method-privatename-identifier-alt.js | 134 +++++++++++ ...atic-generator-method-privatename-identifier.js | 135 +++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 132 +++++++++++ ...-gen-rs-static-method-privatename-identifier.js | 132 +++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 120 ++++++++++ ...ync-gen-rs-static-privatename-identifier-alt.js | 120 ++++++++++ ...s-static-privatename-identifier-by-classname.js | 120 ++++++++++ ...name-identifier-initializer-alt-by-classname.js | 114 +++++++++ ...tatic-privatename-identifier-initializer-alt.js | 114 +++++++++ ...rs-static-privatename-identifier-initializer.js | 114 +++++++++ ...e-async-gen-rs-static-privatename-identifier.js | 120 ++++++++++ .../same-line-async-gen-static-private-fields.js | 81 +++++++ ...async-gen-static-private-methods-with-fields.js | 98 ++++++++ .../same-line-async-gen-static-private-methods.js | 85 +++++++ .../same-line-async-gen-string-literal-names.js | 95 ++++++++ .../same-line-async-method-computed-names.js | 89 +++++++ ...same-line-async-method-computed-symbol-names.js | 84 +++++++ ...privatename-identifier-semantics-stringvalue.js | 118 +++++++++ .../same-line-async-method-literal-names-asi.js | 74 ++++++ .../same-line-async-method-literal-names.js | 87 +++++++ .../same-line-async-method-private-field-usage.js | 58 +++++ ...ine-async-method-private-method-getter-usage.js | 58 +++++ .../same-line-async-method-private-method-usage.js | 58 +++++ .../same-line-async-method-private-names.js | 80 +++++++ ...async-method-rs-field-identifier-initializer.js | 96 ++++++++ .../same-line-async-method-rs-field-identifier.js | 103 ++++++++ ...same-line-async-method-rs-private-getter-alt.js | 137 +++++++++++ .../same-line-async-method-rs-private-getter.js | 137 +++++++++++ ...same-line-async-method-rs-private-method-alt.js | 136 +++++++++++ .../same-line-async-method-rs-private-method.js | 136 +++++++++++ ...same-line-async-method-rs-private-setter-alt.js | 136 +++++++++++ .../same-line-async-method-rs-private-setter.js | 136 +++++++++++ ...e-async-method-rs-privatename-identifier-alt.js | 118 +++++++++ ...od-rs-privatename-identifier-initializer-alt.js | 112 +++++++++ ...method-rs-privatename-identifier-initializer.js | 112 +++++++++ ...-line-async-method-rs-privatename-identifier.js | 118 +++++++++ ...-generator-method-privatename-identifier-alt.js | 144 +++++++++++ ...sync-generator-method-privatename-identifier.js | 145 ++++++++++++ ...atic-async-method-privatename-identifier-alt.js | 144 +++++++++++ ...s-static-async-method-privatename-identifier.js | 145 ++++++++++++ ...-generator-method-privatename-identifier-alt.js | 133 +++++++++++ ...atic-generator-method-privatename-identifier.js | 134 +++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 131 ++++++++++ ...thod-rs-static-method-privatename-identifier.js | 131 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 119 ++++++++++ ...-method-rs-static-privatename-identifier-alt.js | 119 ++++++++++ ...s-static-privatename-identifier-by-classname.js | 119 ++++++++++ ...name-identifier-initializer-alt-by-classname.js | 113 +++++++++ ...tatic-privatename-identifier-initializer-alt.js | 113 +++++++++ ...rs-static-privatename-identifier-initializer.js | 113 +++++++++ ...sync-method-rs-static-privatename-identifier.js | 119 ++++++++++ ...same-line-async-method-static-private-fields.js | 80 +++++++ ...nc-method-static-private-methods-with-fields.js | 97 ++++++++ ...ame-line-async-method-static-private-methods.js | 84 +++++++ .../same-line-async-method-string-literal-names.js | 94 ++++++++ .../class/elements/same-line-gen-computed-names.js | 77 ++++++ .../same-line-gen-computed-symbol-names.js | 72 ++++++ ...privatename-identifier-semantics-stringvalue.js | 107 +++++++++ .../elements/same-line-gen-literal-names-asi.js | 62 +++++ .../class/elements/same-line-gen-literal-names.js | 75 ++++++ .../elements/same-line-gen-private-field-usage.js | 47 ++++ .../same-line-gen-private-method-getter-usage.js | 47 ++++ .../elements/same-line-gen-private-method-usage.js | 47 ++++ .../class/elements/same-line-gen-private-names.js | 69 ++++++ ...ame-line-gen-rs-field-identifier-initializer.js | 84 +++++++ .../elements/same-line-gen-rs-field-identifier.js | 91 +++++++ .../same-line-gen-rs-private-getter-alt.js | 126 ++++++++++ .../elements/same-line-gen-rs-private-getter.js | 126 ++++++++++ .../same-line-gen-rs-private-method-alt.js | 125 ++++++++++ .../elements/same-line-gen-rs-private-method.js | 125 ++++++++++ .../same-line-gen-rs-private-setter-alt.js | 125 ++++++++++ .../elements/same-line-gen-rs-private-setter.js | 125 ++++++++++ .../same-line-gen-rs-privatename-identifier-alt.js | 107 +++++++++ ...en-rs-privatename-identifier-initializer-alt.js | 101 ++++++++ ...ne-gen-rs-privatename-identifier-initializer.js | 101 ++++++++ .../same-line-gen-rs-privatename-identifier.js | 107 +++++++++ ...-generator-method-privatename-identifier-alt.js | 131 ++++++++++ ...sync-generator-method-privatename-identifier.js | 132 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 131 ++++++++++ ...s-static-async-method-privatename-identifier.js | 132 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 122 ++++++++++ ...atic-generator-method-privatename-identifier.js | 123 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 120 ++++++++++ ...-gen-rs-static-method-privatename-identifier.js | 120 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 108 +++++++++ ...ine-gen-rs-static-privatename-identifier-alt.js | 108 +++++++++ ...s-static-privatename-identifier-by-classname.js | 108 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 102 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 102 ++++++++ ...rs-static-privatename-identifier-initializer.js | 102 ++++++++ ...me-line-gen-rs-static-privatename-identifier.js | 108 +++++++++ .../same-line-gen-static-private-fields.js | 69 ++++++ ...-line-gen-static-private-methods-with-fields.js | 86 +++++++ .../same-line-gen-static-private-methods.js | 73 ++++++ .../elements/same-line-gen-string-literal-names.js | 82 +++++++ .../elements/same-line-method-computed-names.js | 77 ++++++ .../same-line-method-computed-symbol-names.js | 72 ++++++ ...privatename-identifier-semantics-stringvalue.js | 107 +++++++++ .../elements/same-line-method-literal-names-asi.js | 62 +++++ .../elements/same-line-method-literal-names.js | 75 ++++++ .../same-line-method-private-field-usage.js | 47 ++++ ...same-line-method-private-method-getter-usage.js | 47 ++++ .../same-line-method-private-method-usage.js | 47 ++++ .../elements/same-line-method-private-names.js | 69 ++++++ ...-line-method-rs-field-identifier-initializer.js | 84 +++++++ .../same-line-method-rs-field-identifier.js | 91 +++++++ .../same-line-method-rs-private-getter-alt.js | 126 ++++++++++ .../elements/same-line-method-rs-private-getter.js | 126 ++++++++++ .../same-line-method-rs-private-method-alt.js | 125 ++++++++++ .../elements/same-line-method-rs-private-method.js | 125 ++++++++++ .../same-line-method-rs-private-setter-alt.js | 125 ++++++++++ .../elements/same-line-method-rs-private-setter.js | 125 ++++++++++ ...me-line-method-rs-privatename-identifier-alt.js | 107 +++++++++ ...od-rs-privatename-identifier-initializer-alt.js | 101 ++++++++ ...method-rs-privatename-identifier-initializer.js | 101 ++++++++ .../same-line-method-rs-privatename-identifier.js | 107 +++++++++ ...-generator-method-privatename-identifier-alt.js | 131 ++++++++++ ...sync-generator-method-privatename-identifier.js | 132 +++++++++++ ...atic-async-method-privatename-identifier-alt.js | 131 ++++++++++ ...s-static-async-method-privatename-identifier.js | 132 +++++++++++ ...-generator-method-privatename-identifier-alt.js | 122 ++++++++++ ...atic-generator-method-privatename-identifier.js | 123 ++++++++++ ...-rs-static-method-privatename-identifier-alt.js | 120 ++++++++++ ...thod-rs-static-method-privatename-identifier.js | 120 ++++++++++ ...atic-privatename-identifier-alt-by-classname.js | 108 +++++++++ ...-method-rs-static-privatename-identifier-alt.js | 108 +++++++++ ...s-static-privatename-identifier-by-classname.js | 108 +++++++++ ...name-identifier-initializer-alt-by-classname.js | 102 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 102 ++++++++ ...rs-static-privatename-identifier-initializer.js | 102 ++++++++ ...line-method-rs-static-privatename-identifier.js | 108 +++++++++ .../same-line-method-static-private-fields.js | 69 ++++++ ...ne-method-static-private-methods-with-fields.js | 86 +++++++ .../same-line-method-static-private-methods.js | 73 ++++++ .../same-line-method-string-literal-names.js | 82 +++++++ .../language/expressions/class/elements/shell.js | 0 .../static-as-valid-instance-field-assigned.js | 38 +++ .../elements/static-as-valid-instance-field.js | 38 +++ .../static-as-valid-static-field-assigned.js | 30 +++ .../class/elements/static-as-valid-static-field.js | 30 +++ ...static-comp-name-init-err-contains-arguments.js | 36 +++ .../static-comp-name-init-err-contains-super.js | 29 +++ .../static-field-anonymous-function-length.js | 64 +++++ .../static-field-anonymous-function-name.js | 73 ++++++ .../class/elements/static-field-declaration.js | 120 ++++++++++ ...static-field-init-this-inside-arrow-function.js | 65 +++++ .../class/elements/static-field-init-with-this.js | 69 ++++++ .../class/elements/static-field-redeclaration.js | 71 ++++++ .../static-literal-init-err-contains-arguments.js | 35 +++ .../static-literal-init-err-contains-super.js | 28 +++ ...-private-fields-proxy-default-handler-throws.js | 31 +++ ...rivate-getter-access-on-inner-arrow-function.js | 47 ++++ .../static-private-getter-access-on-inner-class.js | 45 ++++ ...atic-private-getter-access-on-inner-function.js | 49 ++++ .../class/elements/static-private-getter.js | 58 +++++ .../static-private-init-err-contains-arguments.js | 35 +++ .../static-private-init-err-contains-super.js | 28 +++ ...rivate-method-access-on-inner-arrow-function.js | 45 ++++ ...atic-private-method-access-on-inner-function.js | 47 ++++ ...ivate-method-and-instance-method-brand-check.js | 67 ++++++ ...ivate-method-referenced-from-instance-method.js | 41 ++++ .../static-private-method-subclass-receiver.js | 40 ++++ ...private-methods-proxy-default-handler-throws.js | 34 +++ ...rivate-setter-access-on-inner-arrow-function.js | 48 ++++ .../static-private-setter-access-on-inner-class.js | 47 ++++ ...atic-private-setter-access-on-inner-function.js | 50 ++++ .../class/elements/static-private-setter.js | 59 +++++ ...ing-literal-name-init-err-contains-arguments.js | 35 +++ ...-string-literal-name-init-err-contains-super.js | 28 +++ ...ing-literal-name-init-err-contains-arguments.js | 35 +++ .../string-literal-name-init-err-contains-super.js | 28 +++ .../expressions/class/elements/syntax/browser.js | 0 .../class/elements/syntax/early-errors/browser.js | 0 .../class-heritage-array-literal-arrow-heritage.js | 26 ++ ...-heritage-array-literal-async-arrow-heritage.js | 26 ++ .../elements/syntax/early-errors/delete/browser.js | 0 ...-call-expression-private-method-accessor-get.js | 46 ++++ ...-call-expression-private-method-accessor-set.js | 46 ++++ ...ete-call-expression-private-method-async-gen.js | 46 ++++ ...-delete-call-expression-private-method-async.js | 46 ++++ ...rr-delete-call-expression-private-method-gen.js | 46 ++++ ...ed-err-delete-call-expression-private-method.js | 46 ++++ ...-delete-call-expression-private-no-reference.js | 46 ++++ ...vered-err-delete-call-expression-privatename.js | 46 ++++ ...ember-expression-private-method-accessor-get.js | 45 ++++ ...ember-expression-private-method-accessor-set.js | 45 ++++ ...e-member-expression-private-method-async-gen.js | 45 ++++ ...elete-member-expression-private-method-async.js | 45 ++++ ...-delete-member-expression-private-method-gen.js | 45 ++++ ...-err-delete-member-expression-private-method.js | 45 ++++ ...elete-member-expression-private-no-reference.js | 44 ++++ ...red-err-delete-member-expression-privatename.js | 44 ++++ ...-call-expression-private-method-accessor-get.js | 40 ++++ ...-call-expression-private-method-accessor-set.js | 40 ++++ ...ete-call-expression-private-method-async-gen.js | 40 ++++ ...-delete-call-expression-private-method-async.js | 40 ++++ ...rr-delete-call-expression-private-method-gen.js | 40 ++++ ...te-err-delete-call-expression-private-method.js | 40 ++++ ...-delete-call-expression-private-no-reference.js | 40 ++++ ...elete-err-delete-call-expression-privatename.js | 40 ++++ ...ember-expression-private-method-accessor-get.js | 39 +++ ...ember-expression-private-method-accessor-set.js | 39 +++ ...e-member-expression-private-method-async-gen.js | 39 +++ ...elete-member-expression-private-method-async.js | 39 +++ ...-delete-member-expression-private-method-gen.js | 39 +++ ...-err-delete-member-expression-private-method.js | 39 +++ ...elete-member-expression-private-no-reference.js | 38 +++ ...ete-err-delete-member-expression-privatename.js | 38 +++ ...-call-expression-private-method-accessor-get.js | 46 ++++ ...-call-expression-private-method-accessor-set.js | 46 ++++ ...ete-call-expression-private-method-async-gen.js | 46 ++++ ...-delete-call-expression-private-method-async.js | 46 ++++ ...rr-delete-call-expression-private-method-gen.js | 46 ++++ ...ed-err-delete-call-expression-private-method.js | 46 ++++ ...-delete-call-expression-private-no-reference.js | 46 ++++ ...vered-err-delete-call-expression-privatename.js | 46 ++++ ...ember-expression-private-method-accessor-get.js | 45 ++++ ...ember-expression-private-method-accessor-set.js | 45 ++++ ...e-member-expression-private-method-async-gen.js | 45 ++++ ...elete-member-expression-private-method-async.js | 45 ++++ ...-delete-member-expression-private-method-gen.js | 45 ++++ ...-err-delete-member-expression-private-method.js | 45 ++++ ...elete-member-expression-private-no-reference.js | 44 ++++ ...red-err-delete-member-expression-privatename.js | 44 ++++ ...-call-expression-private-method-accessor-get.js | 49 ++++ ...-call-expression-private-method-accessor-set.js | 49 ++++ ...ete-call-expression-private-method-async-gen.js | 49 ++++ ...-delete-call-expression-private-method-async.js | 49 ++++ ...rr-delete-call-expression-private-method-gen.js | 49 ++++ ...ed-err-delete-call-expression-private-method.js | 49 ++++ ...-delete-call-expression-private-no-reference.js | 49 ++++ ...vered-err-delete-call-expression-privatename.js | 49 ++++ ...ember-expression-private-method-accessor-get.js | 48 ++++ ...ember-expression-private-method-accessor-set.js | 48 ++++ ...e-member-expression-private-method-async-gen.js | 48 ++++ ...elete-member-expression-private-method-async.js | 48 ++++ ...-delete-member-expression-private-method-gen.js | 48 ++++ ...-err-delete-member-expression-private-method.js | 48 ++++ ...elete-member-expression-private-no-reference.js | 47 ++++ ...red-err-delete-member-expression-privatename.js | 47 ++++ ...-call-expression-private-method-accessor-get.js | 43 ++++ ...-call-expression-private-method-accessor-set.js | 43 ++++ ...ete-call-expression-private-method-async-gen.js | 43 ++++ ...-delete-call-expression-private-method-async.js | 43 ++++ ...rr-delete-call-expression-private-method-gen.js | 43 ++++ ...te-err-delete-call-expression-private-method.js | 43 ++++ ...-delete-call-expression-private-no-reference.js | 43 ++++ ...elete-err-delete-call-expression-privatename.js | 43 ++++ ...ember-expression-private-method-accessor-get.js | 42 ++++ ...ember-expression-private-method-accessor-set.js | 42 ++++ ...e-member-expression-private-method-async-gen.js | 42 ++++ ...elete-member-expression-private-method-async.js | 42 ++++ ...-delete-member-expression-private-method-gen.js | 42 ++++ ...-err-delete-member-expression-private-method.js | 42 ++++ ...elete-member-expression-private-no-reference.js | 41 ++++ ...ete-err-delete-member-expression-privatename.js | 41 ++++ ...-call-expression-private-method-accessor-get.js | 49 ++++ ...-call-expression-private-method-accessor-set.js | 49 ++++ ...ete-call-expression-private-method-async-gen.js | 49 ++++ ...-delete-call-expression-private-method-async.js | 49 ++++ ...rr-delete-call-expression-private-method-gen.js | 49 ++++ ...ed-err-delete-call-expression-private-method.js | 49 ++++ ...-delete-call-expression-private-no-reference.js | 49 ++++ ...vered-err-delete-call-expression-privatename.js | 49 ++++ ...ember-expression-private-method-accessor-get.js | 48 ++++ ...ember-expression-private-method-accessor-set.js | 48 ++++ ...e-member-expression-private-method-async-gen.js | 48 ++++ ...elete-member-expression-private-method-async.js | 48 ++++ ...-delete-member-expression-private-method-gen.js | 48 ++++ ...-err-delete-member-expression-private-method.js | 48 ++++ ...elete-member-expression-private-no-reference.js | 47 ++++ ...red-err-delete-member-expression-privatename.js | 47 ++++ .../elements/syntax/early-errors/delete/shell.js | 0 .../grammar-class-body-ctor-duplicate.js | 26 ++ .../early-errors/grammar-ctor-super-no-heritage.js | 30 +++ .../grammar-field-identifier-invalid-ues-error.js | 71 ++++++ .../grammar-field-identifier-invalid-zwj-error.js | 71 ++++++ .../grammar-field-identifier-invalid-zwnj-error.js | 71 ++++++ .../early-errors/grammar-fields-same-line-error.js | 34 +++ ...-environment-on-class-heritage-array-literal.js | 40 ++++ ...-environment-on-class-heritage-chained-usage.js | 40 ++++ ...onment-on-class-heritage-function-expression.js | 40 ++++ ...te-environment-on-class-heritage-obj-literal.js | 40 ++++ ...vate-environment-on-class-heritage-recursive.js | 40 ++++ ...rammar-private-environment-on-class-heritage.js | 40 ++++ ...rammar-private-field-on-object-destructuring.js | 33 +++ .../grammar-private-field-super-access.js | 36 +++ .../grammar-privatemeth-duplicate-async-gen.js | 27 +++ .../grammar-privatemeth-duplicate-async.js | 27 +++ .../grammar-privatemeth-duplicate-gen.js | 27 +++ .../grammar-privatemeth-duplicate-get-field.js | 27 +++ .../grammar-privatemeth-duplicate-get-get.js | 27 +++ .../grammar-privatemeth-duplicate-meth-field.js | 27 +++ .../grammar-privatemeth-duplicate-meth-get.js | 27 +++ .../grammar-privatemeth-duplicate-meth-meth.js | 27 +++ .../grammar-privatemeth-duplicate-meth-set.js | 27 +++ ...ammar-privatemeth-duplicate-meth-staticfield.js | 27 +++ ...rammar-privatemeth-duplicate-meth-staticmeth.js | 27 +++ .../grammar-privatemeth-duplicate-set-field.js | 27 +++ .../grammar-privatemeth-duplicate-set-set.js | 27 +++ .../grammar-privatename-constructor.js | 26 ++ .../early-errors/grammar-privatename-error.js | 37 +++ .../grammar-privatename-identifier-invalid-ues.js | 65 +++++ ...mar-privatename-identifier-invalid-zwj-error.js | 66 ++++++ ...ar-privatename-identifier-invalid-zwnj-error.js | 66 ++++++ ...mar-privatename-in-computed-property-missing.js | 53 +++++ ...ivatename-whitespace-error-accessor-get-meth.js | 30 +++ ...ivatename-whitespace-error-accessor-set-meth.js | 30 +++ ...-privatename-whitespace-error-async-gen-meth.js | 30 +++ ...mmar-privatename-whitespace-error-async-meth.js | 30 +++ ...ammar-privatename-whitespace-error-call-expr.js | 40 ++++ ...mmar-privatename-whitespace-error-field-init.js | 30 +++ .../grammar-privatename-whitespace-error-field.js | 30 +++ ...rammar-privatename-whitespace-error-gen-meth.js | 30 +++ ...mar-privatename-whitespace-error-member-expr.js | 35 +++ ...ammar-privatename-whitespace-error-meth.case.js | 30 +++ ...me-whitespace-error-static-accessor-get-meth.js | 30 +++ ...me-whitespace-error-static-accessor-set-meth.js | 30 +++ ...ename-whitespace-error-static-async-gen-meth.js | 30 +++ ...ivatename-whitespace-error-static-async-meth.js | 30 +++ ...ivatename-whitespace-error-static-field-init.js | 30 +++ ...ar-privatename-whitespace-error-static-field.js | 30 +++ ...privatename-whitespace-error-static-gen-meth.js | 30 +++ ...mar-privatename-whitespace-error-static-meth.js | 30 +++ .../grammar-privatenames-same-line-error.js | 37 +++ ...rammar-special-meth-contains-super-async-gen.js | 28 +++ .../grammar-special-meth-contains-super-async.js | 28 +++ .../grammar-special-meth-contains-super-gen.js | 28 +++ .../grammar-special-meth-contains-super-get.js | 28 +++ .../grammar-special-meth-contains-super-method.js | 28 +++ ...pecial-meth-contains-super-private-async-gen.js | 28 +++ ...ar-special-meth-contains-super-private-async.js | 28 +++ ...mmar-special-meth-contains-super-private-gen.js | 28 +++ ...r-special-meth-contains-super-private-method.js | 28 +++ .../grammar-special-meth-contains-super-set.js | 28 +++ .../grammar-special-meth-ctor-async-gen.js | 26 ++ .../grammar-special-meth-ctor-async-meth.js | 26 ++ .../early-errors/grammar-special-meth-ctor-gen.js | 26 ++ .../early-errors/grammar-special-meth-ctor-get.js | 26 ++ .../early-errors/grammar-special-meth-ctor-set.js | 26 ++ .../grammar-static-async-gen-meth-prototype.js | 26 ++ .../grammar-static-async-gen-meth-super.js | 28 +++ .../grammar-static-async-meth-prototype.js | 26 ++ .../grammar-static-async-meth-super.js | 28 +++ .../grammar-static-gen-meth-prototype.js | 26 ++ .../early-errors/grammar-static-gen-meth-super.js | 28 +++ .../grammar-static-get-meth-prototype.js | 26 ++ .../early-errors/grammar-static-get-meth-super.js | 28 +++ .../early-errors/grammar-static-meth-prototype.js | 26 ++ .../early-errors/grammar-static-meth-super.js | 28 +++ ...ar-static-private-async-gen-meth-constructor.js | 26 ++ .../grammar-static-private-async-gen-meth-super.js | 28 +++ ...rammar-static-private-async-meth-constructor.js | 26 ++ .../grammar-static-private-async-meth-super.js | 28 +++ .../grammar-static-private-gen-meth-constructor.js | 26 ++ .../grammar-static-private-gen-meth-super.js | 28 +++ .../grammar-static-private-meth-constructor.js | 26 ++ .../grammar-static-private-meth-super.js | 28 +++ .../grammar-static-privatename-constructor.js | 26 ++ .../grammar-static-set-meth-prototype.js | 26 ++ .../early-errors/grammar-static-set-meth-super.js | 28 +++ .../syntax/early-errors/invalid-names/browser.js | 0 .../field-init-call-expression-bad-reference.js | 53 +++++ .../field-init-call-expression-this.js | 53 +++++ .../field-init-fn-call-expression-bad-reference.js | 53 +++++ .../field-init-fn-call-expression-this.js | 53 +++++ ...ield-init-fn-member-expression-bad-reference.js | 53 +++++ .../field-init-fn-member-expression-this.js | 53 +++++ ...-init-heritage-call-expression-bad-reference.js | 57 +++++ .../field-init-heritage-call-expression-this.js | 57 +++++ ...nit-heritage-member-expression-bad-reference.js | 57 +++++ .../field-init-heritage-member-expression-this.js | 57 +++++ .../field-init-member-expression-bad-reference.js | 53 +++++ .../field-init-member-expression-this.js | 53 +++++ .../method-call-expression-bad-reference.js | 53 +++++ .../invalid-names/method-call-expression-this.js | 53 +++++ .../method-fn-call-expression-bad-reference.js | 55 +++++ .../method-fn-call-expression-this.js | 55 +++++ .../method-fn-member-expression-bad-reference.js | 55 +++++ .../method-fn-member-expression-this.js | 55 +++++ ...ethod-heritage-call-expression-bad-reference.js | 59 +++++ .../method-heritage-call-expression-this.js | 59 +++++ ...hod-heritage-member-expression-bad-reference.js | 59 +++++ .../method-heritage-member-expression-this.js | 59 +++++ .../method-member-expression-bad-reference.js | 53 +++++ .../invalid-names/method-member-expression-this.js | 53 +++++ .../method-outter-call-expression-bad-reference.js | 59 +++++ .../method-outter-call-expression-this.js | 59 +++++ ...ethod-outter-member-expression-bad-reference.js | 59 +++++ .../method-outter-member-expression-this.js | 59 +++++ .../syntax/early-errors/invalid-names/shell.js | 0 .../private-async-generator-cannot-escape-token.js | 26 ++ .../private-async-method-cannot-escape-token.js | 26 ++ .../private-call-exp-cannot-escape-token.js | 34 +++ .../private-field-cannot-escape-token.js | 26 ++ .../private-generator-cannot-escape-token.js | 26 ++ .../private-member-exp-cannot-escape-token.js | 34 +++ .../private-method-cannot-escape-token.js | 26 ++ .../class/elements/syntax/early-errors/shell.js | 0 .../early-errors/super-private-access-invalid.js | 37 +++ .../expressions/class/elements/syntax/shell.js | 0 .../class/elements/syntax/valid/browser.js | 0 .../valid/grammar-class-body-ctor-no-heritage.js | 24 ++ ...ammar-field-classelementname-initializer-alt.js | 72 ++++++ .../grammar-field-classelementname-initializer.js | 72 ++++++ .../syntax/valid/grammar-field-identifier-alt.js | 72 ++++++ .../syntax/valid/grammar-field-identifier.js | 72 ++++++ .../syntax/valid/grammar-fields-multi-line.js | 31 +++ .../valid/grammar-privatemeth-duplicate-get-set.js | 24 ++ ...r-privatemeth-duplicate-meth-nestedclassmeth.js | 29 +++ ...privatename-classelementname-initializer-alt.js | 70 ++++++ ...mar-privatename-classelementname-initializer.js | 70 ++++++ .../syntax/valid/grammar-privatename-identifier.js | 67 ++++++ ...ammar-privatename-no-initializer-with-method.js | 35 +++ .../valid/grammar-privatenames-multi-line.js | 35 +++ ...rammar-special-prototype-accessor-meth-valid.js | 58 +++++ ...ammar-special-prototype-async-gen-meth-valid.js | 51 ++++ .../grammar-special-prototype-async-meth-valid.js | 51 ++++ .../grammar-special-prototype-gen-meth-valid.js | 51 ++++ .../valid/grammar-special-prototype-meth-valid.js | 51 ++++ .../grammar-static-ctor-accessor-meth-valid.js | 32 +++ .../grammar-static-ctor-async-gen-meth-valid.js | 31 +++ .../valid/grammar-static-ctor-async-meth-valid.js | 31 +++ .../valid/grammar-static-ctor-gen-meth-valid.js | 31 +++ .../syntax/valid/grammar-static-ctor-meth-valid.js | 31 +++ ...mmar-static-private-async-gen-meth-prototype.js | 23 ++ .../grammar-static-private-async-meth-prototype.js | 23 ++ .../grammar-static-private-gen-meth-prototype.js | 23 ++ .../valid/grammar-static-private-meth-prototype.js | 23 ++ .../class/elements/syntax/valid/shell.js | 0 .../ternary-init-err-contains-arguments.js | 35 +++ .../elements/ternary-init-err-contains-super.js | 28 +++ .../elements/typeof-init-err-contains-arguments.js | 35 +++ .../elements/typeof-init-err-contains-super.js | 28 +++ .../class/elements/wrapped-in-sc-computed-names.js | 69 ++++++ .../wrapped-in-sc-computed-symbol-names.js | 64 +++++ ...privatename-identifier-semantics-stringvalue.js | 98 ++++++++ .../elements/wrapped-in-sc-literal-names-asi.js | 54 +++++ .../class/elements/wrapped-in-sc-literal-names.js | 67 ++++++ .../elements/wrapped-in-sc-private-field-usage.js | 38 +++ .../wrapped-in-sc-private-method-getter-usage.js | 38 +++ .../elements/wrapped-in-sc-private-method-usage.js | 38 +++ .../class/elements/wrapped-in-sc-private-names.js | 60 +++++ ...rapped-in-sc-rs-field-identifier-initializer.js | 75 ++++++ .../elements/wrapped-in-sc-rs-field-identifier.js | 82 +++++++ .../wrapped-in-sc-rs-private-getter-alt.js | 117 +++++++++ .../elements/wrapped-in-sc-rs-private-getter.js | 117 +++++++++ .../wrapped-in-sc-rs-private-method-alt.js | 116 +++++++++ .../elements/wrapped-in-sc-rs-private-method.js | 116 +++++++++ .../wrapped-in-sc-rs-private-setter-alt.js | 116 +++++++++ .../elements/wrapped-in-sc-rs-private-setter.js | 116 +++++++++ .../wrapped-in-sc-rs-privatename-identifier-alt.js | 98 ++++++++ ...sc-rs-privatename-identifier-initializer-alt.js | 92 +++++++ ...-in-sc-rs-privatename-identifier-initializer.js | 92 +++++++ .../wrapped-in-sc-rs-privatename-identifier.js | 98 ++++++++ ...-generator-method-privatename-identifier-alt.js | 122 ++++++++++ ...sync-generator-method-privatename-identifier.js | 123 ++++++++++ ...atic-async-method-privatename-identifier-alt.js | 122 ++++++++++ ...s-static-async-method-privatename-identifier.js | 123 ++++++++++ ...-generator-method-privatename-identifier-alt.js | 113 +++++++++ ...atic-generator-method-privatename-identifier.js | 114 +++++++++ ...-rs-static-method-privatename-identifier-alt.js | 111 +++++++++ ...n-sc-rs-static-method-privatename-identifier.js | 111 +++++++++ ...atic-privatename-identifier-alt-by-classname.js | 99 ++++++++ ...d-in-sc-rs-static-privatename-identifier-alt.js | 99 ++++++++ ...s-static-privatename-identifier-by-classname.js | 99 ++++++++ ...name-identifier-initializer-alt-by-classname.js | 93 ++++++++ ...tatic-privatename-identifier-initializer-alt.js | 93 ++++++++ ...rs-static-privatename-identifier-initializer.js | 93 ++++++++ ...apped-in-sc-rs-static-privatename-identifier.js | 99 ++++++++ .../wrapped-in-sc-static-private-fields.js | 60 +++++ ...ped-in-sc-static-private-methods-with-fields.js | 77 ++++++ .../wrapped-in-sc-static-private-methods.js | 64 +++++ .../elements/wrapped-in-sc-string-literal-names.js | 74 ++++++ 1455 files changed, 111289 insertions(+) create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-method-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-next.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-return.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-next.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-return.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-next.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-return.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-next.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-return.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/async-private-method/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-anonymous.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-decl.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-default-export.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-expr.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive-symbol.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/ctor-called-after-fields-init.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-referenceerror.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-err.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-tostring-err.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-valueof-err.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/evaluation-error/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/field-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-anonymous-function-length.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-asi-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-asi-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-asi-3.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-asi-4.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-asi-5.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-computed-name-static-propname-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-duplicate-privatenames.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-literal-name-propname-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-run-once-on-double-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-string-name-propname-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/grammar-private-field-optional-chaining.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/indirect-eval-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/indirect-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/init-err-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/init-value-defined-after-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/init-value-incremental.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/intercalated-static-non-static-computed-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-definitions-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWNJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-common.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-dollar.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-u2118.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-underscore.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWNJ.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-common.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-dollar.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-u2118.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-underscore.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-async-generator-method-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-async-method-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-after-optional-chain.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-as-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-as-async-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-as-async-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-as-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-field-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-fields-proxy-default-handler-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-generator-method-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-is-not-a-own-property.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-field-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-getter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-method-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-setter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-err-contains-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-comparison.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-get-and-call.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-is-not-a-own-property.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-length.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-referenced-from-static-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-field-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-getter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-setter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-methods/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-generator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-generator.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-methods/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-is-not-a-own-property.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-field-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-getter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-method-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-setter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-async-generator-method-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-async-method-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-field-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-method-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-field-usage-inside-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-generator-method-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-method-length.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-method-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-field-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-method-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-static-method-usage-inside-nested-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/redeclaration-symbol.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/redeclaration.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/regular-definitions-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-async-method-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-gen-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/same-line-method-string-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field-assigned.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field-assigned.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-length.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-name.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-field-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-field-init-this-inside-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-field-init-with-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-field-redeclaration.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-fields-proxy-default-handler-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-method-and-instance-method-brand-check.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-method-referenced-from-instance-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-method-subclass-receiver.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-methods-proxy-default-handler-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-class.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-fields-same-line-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-super-access.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-field-cannot-escape-token.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-method-cannot-escape-token.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-fields-multi-line.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatenames-multi-line.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-meth-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/syntax/valid/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-super.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-symbol-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names-asi.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-field-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-getter-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-usage.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-names.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods-with-fields.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods.js create mode 100644 js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-string-literal-names.js (limited to 'js/src/tests/test262/language/expressions/class/elements') diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-names.js new file mode 100644 index 0000000000..a0f90044c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-names.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Computed property names (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000..cc5533e1a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-symbol-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Computed property symbol names (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + *m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..0514243bc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + *m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names-asi.js new file mode 100644 index 0000000000..2d904ce157 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names-asi.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Literal property names with ASI (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + *m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names.js new file mode 100644 index 0000000000..be32d0c893 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Literal property names (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + *m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-field-usage.js new file mode 100644 index 0000000000..3a524996c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-field-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + *m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-getter-usage.js new file mode 100644 index 0000000000..ce60dc7da5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-getter-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + *m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-usage.js new file mode 100644 index 0000000000..79bf03a58f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + *m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-names.js new file mode 100644 index 0000000000..88cd80617c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-names.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: private names (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + *m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..1d4cdff5f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier-initializer.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid FieldDefinition (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier.js new file mode 100644 index 0000000000..bc15ad38ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid FieldDefinition (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter-alt.js new file mode 100644 index 0000000000..dc5a025334 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter.js new file mode 100644 index 0000000000..56dacec911 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method-alt.js new file mode 100644 index 0000000000..aa79a70bed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method.js new file mode 100644 index 0000000000..fdf31f6aae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter-alt.js new file mode 100644 index 0000000000..de59113f44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter.js new file mode 100644 index 0000000000..50e5592fb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..5b5ce3825a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..638ff2fe4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..4c76b7ce0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier.js new file mode 100644 index 0000000000..2b1b7b18f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..4887896b35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..c117ee6553 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..4e99f9f344 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..df25b1117b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..0340957b7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..148ab160b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..02dcf7270f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..4c7e931dfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..0bb8e20bd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..7277f9d9c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..30b0ec270d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..c0f4c903f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..de7794e8a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..f55791c03b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..73134ff12a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-fields.js new file mode 100644 index 0000000000..92803da0e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-fields.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: static private fields (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + *m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..102baf0ffd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: static private methods with fields (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods.js new file mode 100644 index 0000000000..4b5ecf80f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods.js @@ -0,0 +1,73 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: static private methods (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + *m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-string-literal-names.js new file mode 100644 index 0000000000..de2ed65bb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-string-literal-names.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-gen.template +/*--- +description: String literal names (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-names.js new file mode 100644 index 0000000000..312bf55a76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-names.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Computed property names (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-symbol-names.js new file mode 100644 index 0000000000..79b9ccacc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-symbol-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Computed property symbol names (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..702d4c5d9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names-asi.js new file mode 100644 index 0000000000..f270633391 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names-asi.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Literal property names with ASI (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names.js new file mode 100644 index 0000000000..e898bab834 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Literal property names (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-field-usage.js new file mode 100644 index 0000000000..49c27fde89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-field-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-getter-usage.js new file mode 100644 index 0000000000..80de7e9351 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-getter-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-usage.js new file mode 100644 index 0000000000..ff4170b388 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-names.js new file mode 100644 index 0000000000..78b0633a84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-names.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: private names (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..bbb2297fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid FieldDefinition (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier.js new file mode 100644 index 0000000000..3398af9902 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid FieldDefinition (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter-alt.js new file mode 100644 index 0000000000..7f44216145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter.js new file mode 100644 index 0000000000..e9d4598f4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method-alt.js new file mode 100644 index 0000000000..54037b7999 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method.js new file mode 100644 index 0000000000..9d2e1a6fa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter-alt.js new file mode 100644 index 0000000000..6e794c741d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter.js new file mode 100644 index 0000000000..ecb930ee24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..d240e2c7f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..41d32c8a46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..6703cbe7f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier.js new file mode 100644 index 0000000000..107b2c9194 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..69aaf83b4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..175c830d5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..730a73b776 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..9d4ae7c32f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..d07326a04a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..e5be0db104 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..412354025e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..0e1becdd32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..08ccb83881 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..af5d88f667 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..423d6330ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..8e5701598e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..15ef55aded --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..c128c6b828 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..afc7f9d180 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-fields.js new file mode 100644 index 0000000000..ad03a79b26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-fields.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: static private fields (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..3924e02456 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: static private methods with fields (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods.js new file mode 100644 index 0000000000..e9145a8592 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods.js @@ -0,0 +1,73 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: static private methods (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-string-literal-names.js new file mode 100644 index 0000000000..408f69edfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-string-literal-names.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-method.template +/*--- +description: String literal names (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-names.js new file mode 100644 index 0000000000..a14b182570 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-names.js @@ -0,0 +1,90 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Computed property names (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static async *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + + verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-symbol-names.js new file mode 100644 index 0000000000..26e232a2af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-symbol-names.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Computed property symbol names (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static async *m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); + assert.sameValue(Object.hasOwnProperty.call(C, x), false); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); + assert.sameValue(Object.hasOwnProperty.call(C, y), false); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..6fbc4f277a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + static async *m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names-asi.js new file mode 100644 index 0000000000..a0d55cc8dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names-asi.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Literal property names with ASI (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async *m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names.js new file mode 100644 index 0000000000..3ecb835bbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Literal property names (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static async *m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true + }); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-field-usage.js new file mode 100644 index 0000000000..28602cc113 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-field-usage.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static async *m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js new file mode 100644 index 0000000000..1c538de790 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static async *m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-usage.js new file mode 100644 index 0000000000..bef0fa191e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-usage.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static async *m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-names.js new file mode 100644 index 0000000000..92271410d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-names.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: private names (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async *m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..a352ae52c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js @@ -0,0 +1,97 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid FieldDefinition (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier.js new file mode 100644 index 0000000000..2b03a15262 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier.js @@ -0,0 +1,104 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid FieldDefinition (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js new file mode 100644 index 0000000000..d16155e6f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js @@ -0,0 +1,138 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter.js new file mode 100644 index 0000000000..2bcbef6ff4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter.js @@ -0,0 +1,138 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js new file mode 100644 index 0000000000..0fe8bb0ab1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method.js new file mode 100644 index 0000000000..16a728bd66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js new file mode 100644 index 0000000000..d01257d314 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter.js new file mode 100644 index 0000000000..f800b0a464 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..6a5a857160 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..5ff53d7133 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..9f4a3f393b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js new file mode 100644 index 0000000000..64e36e839f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..1f3d9ffa6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..0fc626524f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,146 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..3f6b03f5c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..5d97498df1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,146 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..28e271606b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,134 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.o([1]).next().value, 1); + assert.sameValue(C.℘([1]).next().value, 1); + assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..0856d0745e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,135 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.\u{6F}([1]).next().value, 1); + assert.sameValue(C.\u2118([1]).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..735ed993f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..90ee64eed1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..67ed7752e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..939655d6a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..ee98bf49ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..4734f66d49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..a17d7ef0d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..7959a1f4eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..40bb50b88d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-fields.js new file mode 100644 index 0000000000..7bb0935104 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-fields.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: static private fields (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async *m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..afb99c4596 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js @@ -0,0 +1,98 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: static private methods with fields (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods.js new file mode 100644 index 0000000000..a9edf0a6c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods.js @@ -0,0 +1,85 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: static private methods (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async *m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-string-literal-names.js new file mode 100644 index 0000000000..b0218d713c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-string-literal-names.js @@ -0,0 +1,95 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: String literal names (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-names.js new file mode 100644 index 0000000000..a5b6081c80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-names.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Computed property names (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static async m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + + verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-symbol-names.js new file mode 100644 index 0000000000..6ecbbf053c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-symbol-names.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Computed property symbol names (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static async m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); + assert.sameValue(Object.hasOwnProperty.call(C, x), false); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); + assert.sameValue(Object.hasOwnProperty.call(C, y), false); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..499c247b99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,118 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + static async m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names-asi.js new file mode 100644 index 0000000000..3434f5e12e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names-asi.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Literal property names with ASI (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names.js new file mode 100644 index 0000000000..d9386b9a82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names.js @@ -0,0 +1,87 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Literal property names (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static async m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true + }); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-field-usage.js new file mode 100644 index 0000000000..88c0a7b5d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-field-usage.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static async m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-getter-usage.js new file mode 100644 index 0000000000..bfc5277f7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-getter-usage.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static async m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-usage.js new file mode 100644 index 0000000000..b70b404d00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-usage.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static async m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-names.js new file mode 100644 index 0000000000..6bf6e22e98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-names.js @@ -0,0 +1,80 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: private names (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..88975710ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js @@ -0,0 +1,96 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid FieldDefinition (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier.js new file mode 100644 index 0000000000..12098b8cbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier.js @@ -0,0 +1,103 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid FieldDefinition (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js new file mode 100644 index 0000000000..3efa2deca1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter.js new file mode 100644 index 0000000000..4d22b83ec0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method-alt.js new file mode 100644 index 0000000000..1d474f8e32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method-alt.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName as private method (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method.js new file mode 100644 index 0000000000..b4d982edf2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName as private method (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js new file mode 100644 index 0000000000..b3e44d1021 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter.js new file mode 100644 index 0000000000..03306c9138 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..27f7fe0e4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js @@ -0,0 +1,118 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..ebc1024767 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,112 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..52a2ec9121 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,112 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js new file mode 100644 index 0000000000..6dfc5953c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js @@ -0,0 +1,118 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..a8b607fb2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..5b4cec9442 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..8794a1e298 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..963dbb794f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..671c51f719 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.o([1]).next().value, 1); + assert.sameValue(C.℘([1]).next().value, 1); + assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..020e97bc5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,134 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.\u{6F}([1]).next().value, 1); + assert.sameValue(C.\u2118([1]).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..90afa83559 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..7dd3b7564c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..777be7fe2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..5b66642ccf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..4154435db1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..5f78fad4e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..109a2e6a8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..39f7e39415 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..46fd175b9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-fields.js new file mode 100644 index 0000000000..595b0f0aba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-fields.js @@ -0,0 +1,80 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: static private fields (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..c9dee88307 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: static private methods with fields (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods.js new file mode 100644 index 0000000000..9eb08fb86a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods.js @@ -0,0 +1,84 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: static private methods (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-string-literal-names.js new file mode 100644 index 0000000000..3fe48591ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-string-literal-names.js @@ -0,0 +1,94 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: String literal names (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-names.js new file mode 100644 index 0000000000..5f5e5af9b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-names.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Computed property names (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-symbol-names.js new file mode 100644 index 0000000000..86292a8320 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-symbol-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Computed property symbol names (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static *m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..a5be07efc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + static *m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names-asi.js new file mode 100644 index 0000000000..8bb4cbc302 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names-asi.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Literal property names with ASI (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static *m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names.js new file mode 100644 index 0000000000..0b1b4f66cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Literal property names (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static *m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-field-usage.js new file mode 100644 index 0000000000..b08ac8f10c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-field-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static *m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-getter-usage.js new file mode 100644 index 0000000000..680be27014 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-getter-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static *m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-usage.js new file mode 100644 index 0000000000..f50eaa7298 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static *m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-names.js new file mode 100644 index 0000000000..fea8c18863 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-names.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: private names (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static *m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..7f320842b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid FieldDefinition (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier.js new file mode 100644 index 0000000000..5c56a3a6da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid FieldDefinition (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter-alt.js new file mode 100644 index 0000000000..0a0dbf7e79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter.js new file mode 100644 index 0000000000..391ec4e87a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method-alt.js new file mode 100644 index 0000000000..ccbe61d7cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method.js new file mode 100644 index 0000000000..7c7f2c433b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter-alt.js new file mode 100644 index 0000000000..bd70189cfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter.js new file mode 100644 index 0000000000..790e55f721 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..1c0efb15fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..e5e4ef0c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..9b8817d22e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier.js new file mode 100644 index 0000000000..1d9fae5439 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..74d39c7b82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..d7972b18dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..6b7e6113cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..3356a99f69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..26162ed838 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..01b4b65483 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..1dc49a7c39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..cd3312886f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..4a7147dfa7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..1a8d652110 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..ee1863b571 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..00b0073d17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..9d2365985a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..2a58bafbec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..1ba011cc99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Valid Static PrivateName (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-fields.js new file mode 100644 index 0000000000..dd2f78692e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-fields.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: static private fields (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static *m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..7651f517cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: static private methods with fields (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods.js new file mode 100644 index 0000000000..d7a0e0dc4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods.js @@ -0,0 +1,73 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: static private methods (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static *m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-string-literal-names.js new file mode 100644 index 0000000000..7193943878 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-string-literal-names.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: String literal names (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-names.js new file mode 100644 index 0000000000..e3eaece72d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-names.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Computed property names (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-symbol-names.js new file mode 100644 index 0000000000..d49c4fa8bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-symbol-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Computed property symbol names (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..c872d84d40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + static m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names-asi.js new file mode 100644 index 0000000000..c3ca5d5d88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names-asi.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Literal property names with ASI (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names.js new file mode 100644 index 0000000000..db4d1cb9f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Literal property names (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-field-usage.js new file mode 100644 index 0000000000..2019227af4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-field-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-getter-usage.js new file mode 100644 index 0000000000..552d3db3f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-getter-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-usage.js new file mode 100644 index 0000000000..c56147279b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + static m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-names.js new file mode 100644 index 0000000000..52c6252526 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-names.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: private names (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..6d68367516 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid FieldDefinition (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier.js new file mode 100644 index 0000000000..bee99a3641 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid FieldDefinition (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter-alt.js new file mode 100644 index 0000000000..5ad90ef549 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter.js new file mode 100644 index 0000000000..ec31f0c68a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method-alt.js new file mode 100644 index 0000000000..d3567cd9db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName as private method (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method.js new file mode 100644 index 0000000000..a3484e2a32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName as private method (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter-alt.js new file mode 100644 index 0000000000..d34942579b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter.js new file mode 100644 index 0000000000..88f7b1b5c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..ffc66d9b04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..9f2396a3ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..1e7ad47d53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier.js new file mode 100644 index 0000000000..f8116001f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..f34378da23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..2952a8e1ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..a8543c96d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..25d0503554 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..5956956905 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..d773711399 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..d519b09e49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..6aa2b72549 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..bddff0248d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..3431c070a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..ff3b2b15a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..1fcdbd8935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..edd26a72a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..f365b867d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..2217ef0a59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Valid Static PrivateName (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-fields.js new file mode 100644 index 0000000000..c30f04f0db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-fields.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: static private fields (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..44675ddb8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods-with-fields.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: static private methods with fields (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods.js new file mode 100644 index 0000000000..2d3c875078 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods.js @@ -0,0 +1,73 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: static private methods (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-string-literal-names.js new file mode 100644 index 0000000000..0255b3d131 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-string-literal-names.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-static-method.template +/*--- +description: String literal names (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..a2111e7654 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-eval-arrow-body.template +/*--- +description: super.x in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; () => super.x;'); +}; + +new C().x(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..b4e85f9217 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-eval-arrow-body.template +/*--- +description: super['x'] in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; () => super["x"];'); +}; + +new C().x(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..eeb377e07f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval-arrow-body.template +/*--- +description: error if `super()['x']` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; () => super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..63aaa459a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval-arrow-body.template +/*--- +description: error if `super().x` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; () => super().x;'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js new file mode 100644 index 0000000000..1880bb650a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval-arrow-body.template +/*--- +description: error if `super()` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; () => super();'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..fb49fcdf89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-indirect-eval-arrow-body.template +/*--- +description: super.x in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var A = class {} +var C = class extends A { + x = (0, eval)('() => super.x;'); +}; + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..da5dd3f9e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-indirect-eval-arrow-body.template +/*--- +description: super['x'] in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var A = class {} +var C = class extends A { + x = (0, eval)('() => super["x"];'); +}; + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..69f3745ef7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval-arrow-body.template +/*--- +description: error if `super()['x']` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var A = class {} +var C = class extends A { + x = (0, eval)('() => super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..a4c0817b78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval-arrow-body.template +/*--- +description: error if `super().x` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var A = class {} +var C = class extends A { + x = (0, eval)('() => super().x;'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js new file mode 100644 index 0000000000..be90af7392 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval-arrow-body.template +/*--- +description: error if `super()` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var A = class {} +var C = class extends A { + x = (0, eval)('() => super();'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-arguments.js new file mode 100644 index 0000000000..f6f1b9d23e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-arguments.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-arguments.case +// - src/class-elements/initializer-direct-eval-arguments/cls-expr-fields-eval-arrow-body.template +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + It is a Syntax Error if ContainsArguments of StatementList is true. + ... + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +let executed = false; +let C = class { + x = eval('executed = true; () => arguments;'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..ecb00a1e22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-direct-eval-err-contains-newtarget.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-fields-eval-arrow-body.template +/*--- +description: error if `new.target` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + x = eval('executed = true; () => new.target;'); +} + +var c = new C(); + +assert.sameValue(executed, true); +assert.sameValue(c.x(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..03ff58e518 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-fields-indirect-eval-arrow-body.template +/*--- +description: error if `new.target` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var C = class { + x = (0, eval)('() => new.target;'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..ca9a5fbe5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-eval-arrow-body.template +/*--- +description: super.x in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; () => super.x;'); + x() { + this.#x(); + } +}; + +new C().x(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..147707983d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-eval-arrow-body.template +/*--- +description: super['x'] in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; () => super["x"];'); + x() { + this.#x(); + } +}; + +new C().x(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..0bc2407159 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval-arrow-body.template +/*--- +description: error if `super()['x']` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; () => super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..6c437a74d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval-arrow-body.template +/*--- +description: error if `super().x` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; () => super().x;'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js new file mode 100644 index 0000000000..c2a04a3879 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval-arrow-body.template +/*--- +description: error if `super()` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; () => super();'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..33cdc55d14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-indirect-eval-arrow-body.template +/*--- +description: super.x in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var A = class {} +var C = class extends A { + #x = (0, eval)('() => super.x;'); +}; + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..1cf22b7932 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-indirect-eval-arrow-body.template +/*--- +description: super['x'] in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var A = class {} +var C = class extends A { + #x = (0, eval)('() => super["x"];'); +}; + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..7fc242a613 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval-arrow-body.template +/*--- +description: error if `super()['x']` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var A = class {} +var C = class extends A { + #x = (0, eval)('() => super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..5f10f66fd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval-arrow-body.template +/*--- +description: error if `super().x` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var A = class {} +var C = class extends A { + #x = (0, eval)('() => super().x;'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js new file mode 100644 index 0000000000..19dd679db8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval-arrow-body.template +/*--- +description: error if `super()` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var A = class {} +var C = class extends A { + #x = (0, eval)('() => super();'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js new file mode 100644 index 0000000000..c2ad99d2ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-arguments.case +// - src/class-elements/initializer-direct-eval-arguments/cls-expr-private-fields-eval-arrow-body.template +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + It is a Syntax Error if ContainsArguments of StatementList is true. + ... + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +var C = class { + #x = eval('() => arguments;'); + x() { + this.#x(); + } +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..6f46a1304f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-private-fields-eval-arrow-body.template +/*--- +description: error if `new.target` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + #x = eval('executed = true; () => new.target;'); + x() { + this.#x(); + } +} + +var c = new C(); + +assert.sameValue(executed, true); +assert.sameValue(c.x(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..df25503d49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-private-fields-indirect-eval-arrow-body.template +/*--- +description: error if `new.target` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var C = class { + #x = (0, eval)('() => new.target;'); +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-arguments.js new file mode 100644 index 0000000000..1ea8d75526 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-arrow-fnc.template +/*--- +description: Syntax error if `arguments` used in class field (arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-super.js new file mode 100644 index 0000000000..10c7a3642a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-fnc-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-arrow-fnc.template +/*--- +description: Syntax error if `super()` used in class field (arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..e8a1c05f93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + var \u0061wait; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier.js new file mode 100644 index 0000000000..344ce7324e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + var await; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..a47ba3eb0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + void \u0061wait; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference.js new file mode 100644 index 0000000000..1fa7293628 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + void await; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..8b36523952 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + \u0061wait: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier.js new file mode 100644 index 0000000000..19c66d2591 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/await-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + await: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/browser.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/shell.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..0eef9f3413 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + var yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js new file mode 100644 index 0000000000..41d820fc96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + var yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..2e36378f86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + void yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js new file mode 100644 index 0000000000..4200607028 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + void yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..ac2cbcaca6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + yi\u0065ld: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier.js new file mode 100644 index 0000000000..c46bde97fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier.case +// - src/async-generators/syntax/async-class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { static async *#gen() { + yield: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..a1ab35e0ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js @@ -0,0 +1,64 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-strict.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [object-spread, async-iteration, class-static-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..57d7cec6c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js @@ -0,0 +1,55 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-strict.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js new file mode 100644 index 0000000000..778b57b0ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js @@ -0,0 +1,60 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-catch.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}).catch(rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js new file mode 100644 index 0000000000..0ea8303bc1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js @@ -0,0 +1,66 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: yield * [Promise.reject(value)] is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + for await (let line of readFile()) { + yield line; + } + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js new file mode 100644 index 0000000000..d94aa6a114 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js @@ -0,0 +1,65 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: yield Promise.reject(value) in for-await-of is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + for await (let value of iterable) { + yield value; + } + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js new file mode 100644 index 0000000000..bd7df86a08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js @@ -0,0 +1,64 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield * readFile(); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}, $DONE).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js new file mode 100644 index 0000000000..536584fed2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js @@ -0,0 +1,63 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield * iterable; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js new file mode 100644 index 0000000000..9150bd8404 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js @@ -0,0 +1,60 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..09a5f2337b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js @@ -0,0 +1,66 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-multiple.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Use yield value in a array spread position (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield [...yield yield]; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next(false); +item = iter.next(['a', 'b', 'c']); + +item.then(({ done, value }) => { + item = iter.next(value); + + item.then(({ done, value }) => { + assert(compareArray(value, arr)); + assert.sameValue(done, false); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-single.js new file mode 100644 index 0000000000..ff4f2a8b71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-single.js @@ -0,0 +1,65 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-single.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Use yield value in a array spread position (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield [...yield]; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next(false); +var item = iter.next(arr); + +item.then(({ done, value }) => { + assert.notSameValue(value, arr, 'value is a new array'); + assert(Array.isArray(value), 'value is an Array exotic object'); + assert.sameValue(value.length, 3) + assert.sameValue(value[0], 'a'); + assert.sameValue(value[1], 'b'); + assert.sameValue(value[2], 'c'); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-obj.js new file mode 100644 index 0000000000..c845702066 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-obj.js @@ -0,0 +1,68 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-obj.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Use yield value in a object spread position (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [object-spread, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next(); +iter.next({ x: 42 }); +iter.next({ x: 'lol' }); +var item = iter.next({ y: 39 }); + +item.then(({ done, value }) => { + assert.sameValue(value.x, 42); + assert.sameValue(value.y, 39); + assert.sameValue(Object.keys(value).length, 2); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-next.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-next.js new file mode 100644 index 0000000000..310f25d84a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-next.js @@ -0,0 +1,235 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-next.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Execution order for yield* with async iterator and next() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + +---*/ +var log = []; +var obj = { + get [Symbol.iterator]() { + log.push({ name: "get [Symbol.iterator]" }); + }, + get [Symbol.asyncIterator]() { + log.push({ + name: "get [Symbol.asyncIterator]", + thisValue: this + }); + return function() { + log.push({ + name: "call [Symbol.asyncIterator]", + thisValue: this, + args: [...arguments] + }); + var nextCount = 0; + return { + name: "asyncIterator", + get next() { + log.push({ + name: "get next", + thisValue: this + }); + return function() { + log.push({ + name: "call next", + thisValue: this, + args: [...arguments] + }); + + nextCount++; + if (nextCount == 1) { + return { + name: "next-promise-1", + get then() { + log.push({ + name: "get next then (1)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call next then (1)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "next-result-1", + get value() { + log.push({ + name: "get next value (1)", + thisValue: this + }); + return "next-value-1"; + }, + get done() { + log.push({ + name: "get next done (1)", + thisValue: this + }); + return false; + } + }); + }; + } + }; + } + + return { + name: "next-promise-2", + get then() { + log.push({ + name: "get next then (2)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call next then (2)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "next-result-2", + get value() { + log.push({ + name: "get next value (2)", + thisValue: this + }); + return "next-value-2"; + }, + get done() { + log.push({ + name: "get next done (2)", + thisValue: this + }); + return true; + } + }); + }; + } + }; + }; + } + }; + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next("next-arg-1").then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get [Symbol.asyncIterator]"); + assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue"); + + assert.sameValue(log[2].name, "call [Symbol.asyncIterator]"); + assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue"); + assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length"); + + assert.sameValue(log[3].name, "get next"); + assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue"); + + assert.sameValue(log[4].name, "call next"); + assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue"); + assert.sameValue(log[4].args.length, 1, "next args.length"); + assert.sameValue(log[4].args[0], undefined, "next args[0]"); + + assert.sameValue(log[5].name, "get next then (1)"); + assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue"); + + assert.sameValue(log[6].name, "call next then (1)"); + assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue"); + assert.sameValue(log[6].args.length, 2, "next then args.length"); + assert.sameValue(typeof log[6].args[0], "function", "next then args[0]"); + assert.sameValue(typeof log[6].args[1], "function", "next then args[1]"); + + assert.sameValue(log[7].name, "get next done (1)"); + assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue"); + + assert.sameValue(log[8].name, "get next value (1)"); + assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 9, "log.length"); + + iter.next("next-arg-2").then(v => { + assert.sameValue(log[9].name, "call next"); + assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue"); + assert.sameValue(log[9].args.length, 1, "next args.length"); + assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]"); + + assert.sameValue(log[10].name, "get next then (2)"); + assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue"); + + assert.sameValue(log[11].name, "call next then (2)"); + assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue"); + assert.sameValue(log[11].args.length, 2, "next then args.length"); + assert.sameValue(typeof log[11].args[0], "function", "next then args[0]"); + assert.sameValue(typeof log[11].args[1], "function", "next then args[1]"); + + assert.sameValue(log[12].name, "get next done (2)"); + assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue"); + + assert.sameValue(log[13].name, "get next value (2)"); + assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue"); + + assert.sameValue(log[14].name, "after yield*"); + assert.sameValue(log[14].value, "next-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 15, "log.length"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-return.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-return.js new file mode 100644 index 0000000000..2efcd64cde --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-return.js @@ -0,0 +1,251 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-return.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: execution order for yield* with async iterator and return() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, Symbol.asyncIterator, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). + iii. If return is undefined, return Completion(received). + iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »). + v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult). + ... + vii. Let done be ? IteratorComplete(innerReturnResult). + viii. If done is true, then + 1. Let value be ? IteratorValue(innerReturnResult). + 2. If generatorKind is async, then set value to ? Await(value). + 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}. + ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)). + ... + + AsyncGeneratorYield ( value ) + ... + 8. Return ! AsyncGeneratorResolve(generator, value, false). + ... + +---*/ +var log = []; +var obj = { + [Symbol.asyncIterator]() { + var returnCount = 0; + return { + name: 'asyncIterator', + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get return() { + log.push({ + name: "get return", + thisValue: this + }); + return function() { + log.push({ + name: "call return", + thisValue: this, + args: [...arguments] + }); + + returnCount++; + if (returnCount == 1) { + return { + name: "return-promise-1", + get then() { + log.push({ + name: "get return then (1)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call return then (1)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "return-result-1", + get value() { + log.push({ + name: "get return value (1)", + thisValue: this + }); + return "return-value-1"; + }, + get done() { + log.push({ + name: "get return done (1)", + thisValue: this + }); + return false; + } + }); + }; + } + }; + } + + return { + name: "return-promise-2", + get then() { + log.push({ + name: "get return then (2)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call return then (2)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "return-result-2", + get value() { + log.push({ + name: "get return value (2)", + thisValue: this + }); + return "return-value-2"; + }, + get done() { + log.push({ + name: "get return done (2)", + thisValue: this + }); + return true; + } + }); + }; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.return("return-arg-1").then(v => { + assert.sameValue(log[2].name, "get return"); + assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue"); + + assert.sameValue(log[3].name, "call return"); + assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue"); + assert.sameValue(log[3].args.length, 1, "return args.length"); + assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]"); + + assert.sameValue(log[4].name, "get return then (1)"); + assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue"); + + assert.sameValue(log[5].name, "call return then (1)"); + assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue"); + assert.sameValue(log[5].args.length, 2, "return then args.length"); + assert.sameValue(typeof log[5].args[0], "function", "return then args[0]"); + assert.sameValue(typeof log[5].args[1], "function", "return then args[1]"); + + assert.sameValue(log[6].name, "get return done (1)"); + assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue"); + + assert.sameValue(log[7].name, "get return value (1)"); + assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 8, "log.length"); + + iter.return("return-arg-2").then(v => { + assert.sameValue(log[8].name, "get return"); + assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue"); + + assert.sameValue(log[9].name, "call return"); + assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue"); + assert.sameValue(log[9].args.length, 1, "return args.length"); + assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]"); + + assert.sameValue(log[10].name, "get return then (2)"); + assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue"); + + assert.sameValue(log[11].name, "call return then (2)"); + assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue"); + assert.sameValue(log[11].args.length, 2, "return then args.length"); + assert.sameValue(typeof log[11].args[0], "function", "return then args[0]"); + assert.sameValue(typeof log[11].args[1], "function", "return then args[1]"); + + assert.sameValue(log[12].name, "get return done (2)"); + assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue"); + + assert.sameValue(log[13].name, "get return value (2)"); + assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-2"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 14, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-throw.js new file mode 100644 index 0000000000..7d844b5e9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-throw.js @@ -0,0 +1,259 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: execution order for yield* with async iterator and throw() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, Symbol.asyncIterator, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »). + 2. If generatorKind is async, then set innerResult to ? Await(innerResult). + ... + 5. Let done be ? IteratorComplete(innerResult). + 6. If done is true, then + a. Let resultValue be Return ? IteratorValue(innerResult). + b. If generatorKind is async, then set resultValue to ? Await(resultValue). + c. Return resultValue. + 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)). + ... + + AsyncGeneratorYield ( value ) + + ... + 8. Return ! AsyncGeneratorResolve(generator, value, false). + ... + +---*/ +var log = []; +var obj = { + [Symbol.asyncIterator]() { + var throwCount = 0; + return { + name: "asyncIterator", + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get throw() { + log.push({ + name: "get throw", + thisValue: this + }); + return function() { + log.push({ + name: "call throw", + thisValue: this, + args: [...arguments] + }); + + throwCount++; + if (throwCount == 1) { + return { + name: "throw-promise-1", + get then() { + log.push({ + name: "get throw then (1)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call throw then (1)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "throw-result-1", + get value() { + log.push({ + name: "get throw value (1)", + thisValue: this + }); + return "throw-value-1"; + }, + get done() { + log.push({ + name: "get throw done (1)", + thisValue: this + }); + return false; + } + }); + }; + } + }; + } + + return { + name: "throw-promise-2", + get then() { + log.push({ + name: "get throw then (2)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call throw then (2)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "throw-result-2", + get value() { + log.push({ + name: "get throw value (2)", + thisValue: this + }); + return "throw-value-2"; + }, + get done() { + log.push({ + name: "get throw done (2)", + thisValue: this + }); + return true; + } + }); + }; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.throw("throw-arg-1").then(v => { + assert.sameValue(log[2].name, "get throw"); + assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue"); + + assert.sameValue(log[3].name, "call throw"); + assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue"); + assert.sameValue(log[3].args.length, 1, "throw args.length"); + assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]"); + + assert.sameValue(log[4].name, "get throw then (1)"); + assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue"); + + assert.sameValue(log[5].name, "call throw then (1)"); + assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue"); + assert.sameValue(log[5].args.length, 2, "throw then args.length"); + assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]"); + assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]"); + + assert.sameValue(log[6].name, "get throw done (1)"); + assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue"); + + assert.sameValue(log[7].name, "get throw value (1)"); + assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue"); + + assert.sameValue(v.value, "throw-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 8, "log.length"); + + iter.throw("throw-arg-2").then(v => { + assert.sameValue(log[8].name, "get throw"); + assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue"); + + assert.sameValue(log[9].name, "call throw"); + assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue"); + assert.sameValue(log[9].args.length, 1, "throw args.length"); + assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]"); + + assert.sameValue(log[10].name, "get throw then (2)"); + assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue"); + + assert.sameValue(log[11].name, "call throw then (2)"); + assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue"); + assert.sameValue(log[11].args.length, 2, "throw then args.length"); + assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]"); + assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]"); + + assert.sameValue(log[12].name, "get throw done (2)"); + assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue"); + + assert.sameValue(log[13].name, "get throw value (2)"); + assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue"); + + assert.sameValue(log[14].name, "after yield*"); + assert.sameValue(log[14].value, "throw-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 15, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js new file mode 100644 index 0000000000..f501265696 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-expr-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting yield* operand (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + ... + +---*/ +var obj = {}; +var abrupt = function() { + throw obj; +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* abrupt(); + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, obj, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js new file mode 100644 index 0000000000..4a62f21799 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting [Symbol.asyncIterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + get [Symbol.asyncIterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js new file mode 100644 index 0000000000..f0ae7a5bed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js @@ -0,0 +1,89 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: false +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js new file mode 100644 index 0000000000..5b1f0a654e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js @@ -0,0 +1,89 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: 0 +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js new file mode 100644 index 0000000000..da90627d8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js @@ -0,0 +1,89 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: {} +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js new file mode 100644 index 0000000000..7133bfbd00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js @@ -0,0 +1,89 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: '' +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js new file mode 100644 index 0000000000..53380c2e88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js @@ -0,0 +1,89 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: Symbol.asyncIterator +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js new file mode 100644 index 0000000000..ce6e5ec99c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js @@ -0,0 +1,95 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting @@iterator after null @@asyncIterator (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var calls = 0; +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw reason; + }, + get [Symbol.asyncIterator]() { + calls += 1; + return null; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + assert.sameValue(calls, 1); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js new file mode 100644 index 0000000000..7b5bd6a4a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while calling [Symbol.asyncIterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js new file mode 100644 index 0000000000..deb99d1752 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - boolean (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return true; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js new file mode 100644 index 0000000000..30b3e450b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-null-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - null (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return null; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js new file mode 100644 index 0000000000..a7bc46b891 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-number-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - number (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return 42; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js new file mode 100644 index 0000000000..6b4e62a5a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-string-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - string (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return '42'; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js new file mode 100644 index 0000000000..9861b6f8d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - symbol (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return Symbol.asyncIterator; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js new file mode 100644 index 0000000000..27b7993870 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - undefined (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return undefined; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js new file mode 100644 index 0000000000..748bc08836 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js @@ -0,0 +1,95 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var calls = 0; +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw reason; + }, + get [Symbol.asyncIterator]() { + calls += 1; + return undefined; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + assert.sameValue(calls, 1); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js new file mode 100644 index 0000000000..2dd03afed6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting [Symbol.iterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js new file mode 100644 index 0000000000..d0d47bd89e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: false +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js new file mode 100644 index 0000000000..0c4e3ba4bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: 0 +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js new file mode 100644 index 0000000000..0fdce3ebdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: {} +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js new file mode 100644 index 0000000000..7c5aeb4747 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: '' +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js new file mode 100644 index 0000000000..8b0b77531a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: Symbol.iterator +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js new file mode 100644 index 0000000000..cca75ce429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js @@ -0,0 +1,83 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while calling [Symbol.iterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + ... + +---*/ +var reason = {}; +var obj = { + [Symbol.iterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js new file mode 100644 index 0000000000..ab29d45332 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - boolean (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return true; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js new file mode 100644 index 0000000000..fd87ab99eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - null (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return null; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js new file mode 100644 index 0000000000..a325a2f062 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - number (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return 0; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js new file mode 100644 index 0000000000..7b0ba87519 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - string (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return ''; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js new file mode 100644 index 0000000000..f8785b4f44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - symbol (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return Symbol.iterator; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js new file mode 100644 index 0000000000..28df44654c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js @@ -0,0 +1,88 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - undefined (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return undefined; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js new file mode 100644 index 0000000000..d86993a4f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-done-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting done (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + v. Let done be ? IteratorComplete(innerResult). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + get done() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js new file mode 100644 index 0000000000..6fba3d4ce6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-returns-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while calling next (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + throw reason; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js new file mode 100644 index 0000000000..c3e4d36051 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js @@ -0,0 +1,91 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-value-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + vi. If done is true, then + 1. Return ? IteratorValue(innerResult). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + done: true, + get value() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js new file mode 100644 index 0000000000..dd00f32fb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Abrupt completion while getting next (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + get next() { + throw reason; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js new file mode 100644 index 0000000000..be3fa67206 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-non-object-ignores-then.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: If next() value is not-object, do not access respective then property (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + +---*/ +Number.prototype.then = function() { + throw new Test262Error('Number#then should not be used'); +}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return 42; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, 'TypeError'); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js new file mode 100644 index 0000000000..14226145cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js @@ -0,0 +1,78 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-boolean-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Not-callable next value in a yield star position - boolean (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: true + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js new file mode 100644 index 0000000000..cf88e4deaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js @@ -0,0 +1,78 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-null-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Not-callable next value in a yield star position - null (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: null + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js new file mode 100644 index 0000000000..8664340166 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js @@ -0,0 +1,78 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-number-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Not-callable next value in a yield star position - number (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: 42 + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js new file mode 100644 index 0000000000..bb37ed413e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js @@ -0,0 +1,78 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-object-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Not-callable next value in a yield star position - object (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: {} + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js new file mode 100644 index 0000000000..36a54cd37c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js @@ -0,0 +1,78 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-string-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Not-callable next value in a yield star position - string (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: '' + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js new file mode 100644 index 0000000000..504d6b08c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js @@ -0,0 +1,78 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-symbol-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Not-callable next value in a yield star position - symbol (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: Symbol('oi') + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js new file mode 100644 index 0000000000..b580df8292 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js @@ -0,0 +1,78 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-undefined-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Not-callable next value in a yield star position - undefined (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: undefined + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js new file mode 100644 index 0000000000..bc8647ba0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js @@ -0,0 +1,105 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-get-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Return abrupt after getting next().then (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 8. Let then be Get(resolution, "then"). + ... + 10. Get thenAction be then.[[Value]]. + ... + 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise, + resolution, thenAction »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + get then() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js new file mode 100644 index 0000000000..28a5fb83c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (boolean) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: true, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js new file mode 100644 index 0000000000..49cd9d821d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (null) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: null, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js new file mode 100644 index 0000000000..3d16feca0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (number) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: 39, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js new file mode 100644 index 0000000000..36f92b9b8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (object) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: {}, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js new file mode 100644 index 0000000000..98fce42819 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (string) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: '', + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js new file mode 100644 index 0000000000..33312fd6e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (symbol) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: Symbol('oi'), + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js new file mode 100644 index 0000000000..5cf1bd0ed8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (undefined) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: undefined, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js new file mode 100644 index 0000000000..90079d1aee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js @@ -0,0 +1,105 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-returns-abrupt.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: Return abrupt after calling next().then (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 8. Let then be Get(resolution, "then"). + ... + 10. Get thenAction be then.[[Value]]. + ... + 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise, + resolution, thenAction »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-next.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-next.js new file mode 100644 index 0000000000..71883cdd1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-next.js @@ -0,0 +1,238 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-next.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: execution order for yield* with sync iterator and next() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + 5. Let received be NormalCompletion(undefined). + 6. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + v. Let done be ? IteratorComplete(innerResult). + vi. If done is true, then + 1. Return ? IteratorValue(innerResult). + vii. Let received be GeneratorYield(innerResult). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + %AsyncFromSyncIteratorPrototype%.next ( value ) + + ... + 5. Let nextResult be IteratorNext(syncIterator, value). + ... + 7. Let nextValue be IteratorValue(nextResult). + ... + 9. Let nextDone be IteratorComplete(nextResult). + ... + 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, + « nextValue »). + ... + 14. Set onFulfilled.[[Done]] to nextDone. + 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]], + onFulfilled, undefined, promiseCapability). + ... + + Async Iterator Value Unwrap Functions + + 1. Return ! CreateIterResultObject(value, F.[[Done]]). + +---*/ +var log = []; +var obj = { + get [Symbol.iterator]() { + log.push({ + name: "get [Symbol.iterator]", + thisValue: this + }); + return function() { + log.push({ + name: "call [Symbol.iterator]", + thisValue: this, + args: [...arguments] + }); + var nextCount = 0; + return { + name: "syncIterator", + get next() { + log.push({ + name: "get next", + thisValue: this + }); + return function() { + log.push({ + name: "call next", + thisValue: this, + args: [...arguments] + }); + + nextCount++; + if (nextCount == 1) { + return { + name: "next-result-1", + get value() { + log.push({ + name: "get next value (1)", + thisValue: this + }); + return "next-value-1"; + }, + get done() { + log.push({ + name: "get next done (1)", + thisValue: this + }); + return false; + } + }; + } + + return { + name: "next-result-2", + get value() { + log.push({ + name: "get next value (2)", + thisValue: this + }); + return "next-value-2"; + }, + get done() { + log.push({ + name: "get next done (2)", + thisValue: this + }); + return true; + } + }; + }; + } + }; + }; + }, + get [Symbol.asyncIterator]() { + log.push({ name: "get [Symbol.asyncIterator]" }); + return null; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next("next-arg-1").then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get [Symbol.asyncIterator]"); + + assert.sameValue(log[2].name, "get [Symbol.iterator]"); + assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue"); + + assert.sameValue(log[3].name, "call [Symbol.iterator]"); + assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue"); + assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length"); + + assert.sameValue(log[4].name, "get next"); + assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue"); + + assert.sameValue(log[5].name, "call next"); + assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue"); + assert.sameValue(log[5].args.length, 1, "next args.length"); + assert.sameValue(log[5].args[0], undefined, "next args[0]"); + + assert.sameValue(log[6].name, "get next done (1)"); + assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue"); + + assert.sameValue(log[7].name, "get next value (1)"); + assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 8, "log.length"); + + iter.next("next-arg-2").then(v => { + assert.sameValue(log[8].name, "call next"); + assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue"); + assert.sameValue(log[8].args.length, 1, "next args.length"); + assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]"); + + assert.sameValue(log[9].name, "get next done (2)"); + assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue"); + + assert.sameValue(log[10].name, "get next value (2)"); + assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue"); + + assert.sameValue(log[11].name, "after yield*"); + assert.sameValue(log[11].value, "next-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 12, "log.length"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-return.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-return.js new file mode 100644 index 0000000000..5ac67ce04d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-return.js @@ -0,0 +1,213 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-return.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: execution order for yield* with sync iterator and return() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). + iii. If return is undefined, return Completion(received). + iv. Let innerReturnResult be ? Call(return, iterator, + « received.[[Value]] »). + v. If generatorKind is async, then set innerReturnResult to + ? Await(innerReturnResult). + ... + vii. Let done be ? IteratorComplete(innerReturnResult). + viii. If done is true, then + 1. Let value be ? IteratorValue(innerReturnResult). + 2. Return Completion{[[Type]]: return, [[Value]]: value, + [[Target]]: empty}. + ix. Let received be GeneratorYield(innerResult). + + %AsyncFromSyncIteratorPrototype%.return ( value ) + + 5. Let return be GetMethod(syncIterator, "return"). + ... + ... + 8. Let returnResult be Call(return, syncIterator, « value »). + ... + 11. Let returnValue be IteratorValue(returnResult). + .. + 13. Let returnDone be IteratorComplete(returnResult). + ... + 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »). + ... + 18. Set onFulfilled.[[Done]] to returnDone. + 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]], + onFulfilled, undefined, promiseCapability). + ... + +---*/ +var log = []; +var obj = { + [Symbol.iterator]() { + var returnCount = 0; + return { + name: "syncIterator", + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get return() { + log.push({ + name: "get return", + thisValue: this + }); + return function() { + log.push({ + name: "call return", + thisValue: this, + args: [...arguments] + }); + + returnCount++; + if (returnCount == 1) { + return { + name: "return-result-1", + get value() { + log.push({ + name: "get return value (1)", + thisValue: this + }); + return "return-value-1"; + }, + get done() { + log.push({ + name: "get return done (1)", + thisValue: this + }); + return false; + } + }; + } + + return { + name: "return-result-2", + get value() { + log.push({ + name: "get return value (2)", + thisValue: this + }); + return "return-value-2"; + }, + get done() { + log.push({ + name: "get return done (2)", + thisValue: this + }); + return true; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.return("return-arg-1").then(v => { + assert.sameValue(log[2].name, "get return"); + assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue"); + + assert.sameValue(log[3].name, "call return"); + assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue"); + assert.sameValue(log[3].args.length, 1, "return args.length"); + assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]"); + + assert.sameValue(log[4].name, "get return done (1)"); + assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue"); + + assert.sameValue(log[5].name, "get return value (1)"); + assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 6, "log.length"); + + iter.return().then(v => { + assert.sameValue(log[6].name, "get return"); + assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue"); + + assert.sameValue(log[7].name, "call return"); + assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue"); + assert.sameValue(log[7].args.length, 1, "return args.length"); + assert.sameValue(log[7].args[0], undefined, "return args[0]"); + + assert.sameValue(log[8].name, "get return done (2)"); + assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue"); + + assert.sameValue(log[9].name, "get return value (2)"); + assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-2"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 10, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-throw.js new file mode 100644 index 0000000000..ad992f6d8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-throw.js @@ -0,0 +1,219 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-throw.case +// - src/async-generators/default/async-class-expr-static-private-method.template +/*--- +description: execution order for yield* with sync iterator and throw() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »). + 2. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + 5. Let done be ? IteratorComplete(innerResult). + 6. If done is true, then + a. Return ? IteratorValue(innerResult). + 7. Let received be GeneratorYield(innerResult). + ... + + %AsyncFromSyncIteratorPrototype%.throw ( value ) + + ... + 5. Let throw be GetMethod(syncIterator, "throw"). + ... + 8. Let throwResult be Call(throw, syncIterator, « value »). + ... + 11. Let throwValue be IteratorValue(throwResult). + ... + 13. Let throwDone be IteratorComplete(throwResult). + ... + 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, + « throwValue »). + ... + 18. Set onFulfilled.[[Done]] to throwDone. + 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]], + onFulfilled, undefined, promiseCapability). + ... + +---*/ +var log = []; +var obj = { + [Symbol.iterator]() { + var throwCount = 0; + return { + name: "syncIterator", + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get throw() { + log.push({ + name: "get throw", + thisValue: this + }); + return function() { + log.push({ + name: "call throw", + thisValue: this, + args: [...arguments] + }); + + throwCount++; + if (throwCount == 1) { + return { + name: "throw-result-1", + get value() { + log.push({ + name: "get throw value (1)", + thisValue: this + }); + return "throw-value-1"; + }, + get done() { + log.push({ + name: "get throw done (1)", + thisValue: this + }); + return false; + } + }; + } + + return { + name: "throw-result-2", + get value() { + log.push({ + name: "get throw value (2)", + thisValue: this + }); + return "throw-value-2"; + }, + get done() { + log.push({ + name: "get throw done (2)", + thisValue: this + }); + return true; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.throw("throw-arg-1").then(v => { + assert.sameValue(log[2].name, "get throw"); + assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue"); + + assert.sameValue(log[3].name, "call throw"); + assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue"); + assert.sameValue(log[3].args.length, 1, "throw args.length"); + assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]"); + + assert.sameValue(log[4].name, "get throw done (1)"); + assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue"); + + assert.sameValue(log[5].name, "get throw value (1)"); + assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue"); + + assert.sameValue(v.value, "throw-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 6, "log.length"); + + iter.throw().then(v => { + assert.sameValue(log[6].name, "get throw"); + assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue"); + + assert.sameValue(log[7].name, "call throw"); + assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue"); + assert.sameValue(log[7].args.length, 1, "throw args.length"); + assert.sameValue(log[7].args[0], undefined, "throw args[0]"); + + assert.sameValue(log[8].name, "get throw done (2)"); + assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue"); + + assert.sameValue(log[9].name, "get throw value (2)"); + assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue"); + + assert.sameValue(log[10].name, "after yield*"); + assert.sameValue(log[10].value, "throw-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 11, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..256d7d3cdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + var \u0061wait; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier.js new file mode 100644 index 0000000000..218567f976 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + var await; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..ebe80e25c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + void \u0061wait; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference.js new file mode 100644 index 0000000000..433d2e6368 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + void await; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..5b0a800e9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + \u0061wait: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier.js new file mode 100644 index 0000000000..484ad3b38f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/await-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + await: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/browser.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/shell.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..cd20234b15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + var yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier.js new file mode 100644 index 0000000000..224924efff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + var yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..0a25c04010 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + void yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference.js new file mode 100644 index 0000000000..d5b1996642 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + void yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..1c6a0c767e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + yi\u0065ld: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier.js new file mode 100644 index 0000000000..66f978579b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier.case +// - src/async-generators/syntax/async-class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator private method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var C = class { async *#gen() { + yield: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..15a8093555 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js @@ -0,0 +1,68 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-strict.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [object-spread, async-iteration, class-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..4d6e3d4325 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-strict-strict.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-strict.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js new file mode 100644 index 0000000000..8ed4325ae7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js @@ -0,0 +1,64 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-catch.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}).catch(rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js new file mode 100644 index 0000000000..27427baa78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: yield * [Promise.reject(value)] is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + for await (let line of readFile()) { + yield line; + } + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js new file mode 100644 index 0000000000..91e3d5651e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: yield Promise.reject(value) in for-await-of is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + for await (let value of iterable) { + yield value; + } + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js new file mode 100644 index 0000000000..8607db9d8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js @@ -0,0 +1,68 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield * readFile(); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}, $DONE).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js new file mode 100644 index 0000000000..4ca7f5999d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js @@ -0,0 +1,67 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield * iterable; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js new file mode 100644 index 0000000000..ade3a5d9df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js @@ -0,0 +1,64 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error("Promise incorrectly resolved."); +}, rejectValue => { + // yield Promise.reject(error); + assert.sameValue(rejectValue, error); + + iter.next().then(({done, value}) => { + // iter is closed now. + assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); + assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..528c8974f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-multiple.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Use yield value in a array spread position (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield [...yield yield]; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(false); +item = iter.next(['a', 'b', 'c']); + +item.then(({ done, value }) => { + item = iter.next(value); + + item.then(({ done, value }) => { + assert(compareArray(value, arr)); + assert.sameValue(done, false); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-single.js new file mode 100644 index 0000000000..37751976eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-single.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-single.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Use yield value in a array spread position (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield [...yield]; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(false); +var item = iter.next(arr); + +item.then(({ done, value }) => { + assert.notSameValue(value, arr, 'value is a new array'); + assert(Array.isArray(value), 'value is an Array exotic object'); + assert.sameValue(value.length, 3) + assert.sameValue(value[0], 'a'); + assert.sameValue(value[1], 'b'); + assert.sameValue(value[2], 'c'); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-obj.js new file mode 100644 index 0000000000..09e509253a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-obj.js @@ -0,0 +1,72 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-obj.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Use yield value in a object spread position (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [object-spread, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(); +iter.next({ x: 42 }); +iter.next({ x: 'lol' }); +var item = iter.next({ y: 39 }); + +item.then(({ done, value }) => { + assert.sameValue(value.x, 42); + assert.sameValue(value.y, 39); + assert.sameValue(Object.keys(value).length, 2); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-next.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-next.js new file mode 100644 index 0000000000..49767e7039 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-next.js @@ -0,0 +1,239 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-next.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Execution order for yield* with async iterator and next() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + +---*/ +var log = []; +var obj = { + get [Symbol.iterator]() { + log.push({ name: "get [Symbol.iterator]" }); + }, + get [Symbol.asyncIterator]() { + log.push({ + name: "get [Symbol.asyncIterator]", + thisValue: this + }); + return function() { + log.push({ + name: "call [Symbol.asyncIterator]", + thisValue: this, + args: [...arguments] + }); + var nextCount = 0; + return { + name: "asyncIterator", + get next() { + log.push({ + name: "get next", + thisValue: this + }); + return function() { + log.push({ + name: "call next", + thisValue: this, + args: [...arguments] + }); + + nextCount++; + if (nextCount == 1) { + return { + name: "next-promise-1", + get then() { + log.push({ + name: "get next then (1)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call next then (1)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "next-result-1", + get value() { + log.push({ + name: "get next value (1)", + thisValue: this + }); + return "next-value-1"; + }, + get done() { + log.push({ + name: "get next done (1)", + thisValue: this + }); + return false; + } + }); + }; + } + }; + } + + return { + name: "next-promise-2", + get then() { + log.push({ + name: "get next then (2)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call next then (2)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "next-result-2", + get value() { + log.push({ + name: "get next value (2)", + thisValue: this + }); + return "next-value-2"; + }, + get done() { + log.push({ + name: "get next done (2)", + thisValue: this + }); + return true; + } + }); + }; + } + }; + }; + } + }; + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next("next-arg-1").then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get [Symbol.asyncIterator]"); + assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue"); + + assert.sameValue(log[2].name, "call [Symbol.asyncIterator]"); + assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue"); + assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length"); + + assert.sameValue(log[3].name, "get next"); + assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue"); + + assert.sameValue(log[4].name, "call next"); + assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue"); + assert.sameValue(log[4].args.length, 1, "next args.length"); + assert.sameValue(log[4].args[0], undefined, "next args[0]"); + + assert.sameValue(log[5].name, "get next then (1)"); + assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue"); + + assert.sameValue(log[6].name, "call next then (1)"); + assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue"); + assert.sameValue(log[6].args.length, 2, "next then args.length"); + assert.sameValue(typeof log[6].args[0], "function", "next then args[0]"); + assert.sameValue(typeof log[6].args[1], "function", "next then args[1]"); + + assert.sameValue(log[7].name, "get next done (1)"); + assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue"); + + assert.sameValue(log[8].name, "get next value (1)"); + assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 9, "log.length"); + + iter.next("next-arg-2").then(v => { + assert.sameValue(log[9].name, "call next"); + assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue"); + assert.sameValue(log[9].args.length, 1, "next args.length"); + assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]"); + + assert.sameValue(log[10].name, "get next then (2)"); + assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue"); + + assert.sameValue(log[11].name, "call next then (2)"); + assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue"); + assert.sameValue(log[11].args.length, 2, "next then args.length"); + assert.sameValue(typeof log[11].args[0], "function", "next then args[0]"); + assert.sameValue(typeof log[11].args[1], "function", "next then args[1]"); + + assert.sameValue(log[12].name, "get next done (2)"); + assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue"); + + assert.sameValue(log[13].name, "get next value (2)"); + assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue"); + + assert.sameValue(log[14].name, "after yield*"); + assert.sameValue(log[14].value, "next-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 15, "log.length"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-return.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-return.js new file mode 100644 index 0000000000..67c932b6f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-return.js @@ -0,0 +1,255 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-return.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: execution order for yield* with async iterator and return() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, Symbol.asyncIterator, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). + iii. If return is undefined, return Completion(received). + iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »). + v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult). + ... + vii. Let done be ? IteratorComplete(innerReturnResult). + viii. If done is true, then + 1. Let value be ? IteratorValue(innerReturnResult). + 2. If generatorKind is async, then set value to ? Await(value). + 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}. + ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)). + ... + + AsyncGeneratorYield ( value ) + ... + 8. Return ! AsyncGeneratorResolve(generator, value, false). + ... + +---*/ +var log = []; +var obj = { + [Symbol.asyncIterator]() { + var returnCount = 0; + return { + name: 'asyncIterator', + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get return() { + log.push({ + name: "get return", + thisValue: this + }); + return function() { + log.push({ + name: "call return", + thisValue: this, + args: [...arguments] + }); + + returnCount++; + if (returnCount == 1) { + return { + name: "return-promise-1", + get then() { + log.push({ + name: "get return then (1)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call return then (1)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "return-result-1", + get value() { + log.push({ + name: "get return value (1)", + thisValue: this + }); + return "return-value-1"; + }, + get done() { + log.push({ + name: "get return done (1)", + thisValue: this + }); + return false; + } + }); + }; + } + }; + } + + return { + name: "return-promise-2", + get then() { + log.push({ + name: "get return then (2)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call return then (2)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "return-result-2", + get value() { + log.push({ + name: "get return value (2)", + thisValue: this + }); + return "return-value-2"; + }, + get done() { + log.push({ + name: "get return done (2)", + thisValue: this + }); + return true; + } + }); + }; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.return("return-arg-1").then(v => { + assert.sameValue(log[2].name, "get return"); + assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue"); + + assert.sameValue(log[3].name, "call return"); + assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue"); + assert.sameValue(log[3].args.length, 1, "return args.length"); + assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]"); + + assert.sameValue(log[4].name, "get return then (1)"); + assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue"); + + assert.sameValue(log[5].name, "call return then (1)"); + assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue"); + assert.sameValue(log[5].args.length, 2, "return then args.length"); + assert.sameValue(typeof log[5].args[0], "function", "return then args[0]"); + assert.sameValue(typeof log[5].args[1], "function", "return then args[1]"); + + assert.sameValue(log[6].name, "get return done (1)"); + assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue"); + + assert.sameValue(log[7].name, "get return value (1)"); + assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 8, "log.length"); + + iter.return("return-arg-2").then(v => { + assert.sameValue(log[8].name, "get return"); + assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue"); + + assert.sameValue(log[9].name, "call return"); + assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue"); + assert.sameValue(log[9].args.length, 1, "return args.length"); + assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]"); + + assert.sameValue(log[10].name, "get return then (2)"); + assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue"); + + assert.sameValue(log[11].name, "call return then (2)"); + assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue"); + assert.sameValue(log[11].args.length, 2, "return then args.length"); + assert.sameValue(typeof log[11].args[0], "function", "return then args[0]"); + assert.sameValue(typeof log[11].args[1], "function", "return then args[1]"); + + assert.sameValue(log[12].name, "get return done (2)"); + assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue"); + + assert.sameValue(log[13].name, "get return value (2)"); + assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-2"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 14, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-throw.js new file mode 100644 index 0000000000..fa221bf0c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-throw.js @@ -0,0 +1,263 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: execution order for yield* with async iterator and throw() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, Symbol.asyncIterator, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »). + 2. If generatorKind is async, then set innerResult to ? Await(innerResult). + ... + 5. Let done be ? IteratorComplete(innerResult). + 6. If done is true, then + a. Let resultValue be Return ? IteratorValue(innerResult). + b. If generatorKind is async, then set resultValue to ? Await(resultValue). + c. Return resultValue. + 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)). + ... + + AsyncGeneratorYield ( value ) + + ... + 8. Return ! AsyncGeneratorResolve(generator, value, false). + ... + +---*/ +var log = []; +var obj = { + [Symbol.asyncIterator]() { + var throwCount = 0; + return { + name: "asyncIterator", + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get throw() { + log.push({ + name: "get throw", + thisValue: this + }); + return function() { + log.push({ + name: "call throw", + thisValue: this, + args: [...arguments] + }); + + throwCount++; + if (throwCount == 1) { + return { + name: "throw-promise-1", + get then() { + log.push({ + name: "get throw then (1)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call throw then (1)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "throw-result-1", + get value() { + log.push({ + name: "get throw value (1)", + thisValue: this + }); + return "throw-value-1"; + }, + get done() { + log.push({ + name: "get throw done (1)", + thisValue: this + }); + return false; + } + }); + }; + } + }; + } + + return { + name: "throw-promise-2", + get then() { + log.push({ + name: "get throw then (2)", + thisValue: this + }); + return function(resolve) { + log.push({ + name: "call throw then (2)", + thisValue: this, + args: [...arguments] + }); + + resolve({ + name: "throw-result-2", + get value() { + log.push({ + name: "get throw value (2)", + thisValue: this + }); + return "throw-value-2"; + }, + get done() { + log.push({ + name: "get throw done (2)", + thisValue: this + }); + return true; + } + }); + }; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.throw("throw-arg-1").then(v => { + assert.sameValue(log[2].name, "get throw"); + assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue"); + + assert.sameValue(log[3].name, "call throw"); + assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue"); + assert.sameValue(log[3].args.length, 1, "throw args.length"); + assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]"); + + assert.sameValue(log[4].name, "get throw then (1)"); + assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue"); + + assert.sameValue(log[5].name, "call throw then (1)"); + assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue"); + assert.sameValue(log[5].args.length, 2, "throw then args.length"); + assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]"); + assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]"); + + assert.sameValue(log[6].name, "get throw done (1)"); + assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue"); + + assert.sameValue(log[7].name, "get throw value (1)"); + assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue"); + + assert.sameValue(v.value, "throw-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 8, "log.length"); + + iter.throw("throw-arg-2").then(v => { + assert.sameValue(log[8].name, "get throw"); + assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue"); + + assert.sameValue(log[9].name, "call throw"); + assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue"); + assert.sameValue(log[9].args.length, 1, "throw args.length"); + assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]"); + + assert.sameValue(log[10].name, "get throw then (2)"); + assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue"); + + assert.sameValue(log[11].name, "call throw then (2)"); + assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue"); + assert.sameValue(log[11].args.length, 2, "throw then args.length"); + assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]"); + assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]"); + + assert.sameValue(log[12].name, "get throw done (2)"); + assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue"); + + assert.sameValue(log[13].name, "get throw value (2)"); + assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue"); + + assert.sameValue(log[14].name, "after yield*"); + assert.sameValue(log[14].value, "throw-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 15, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-expr-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-expr-abrupt.js new file mode 100644 index 0000000000..ec5fef9e83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-expr-abrupt.js @@ -0,0 +1,74 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-expr-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting yield* operand (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + ... + +---*/ +var obj = {}; +var abrupt = function() { + throw obj; +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* abrupt(); + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, obj, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js new file mode 100644 index 0000000000..321bdf47d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js @@ -0,0 +1,94 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting [Symbol.asyncIterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + get [Symbol.asyncIterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js new file mode 100644 index 0000000000..40842ce7fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: false +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js new file mode 100644 index 0000000000..07f17d06b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: 0 +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js new file mode 100644 index 0000000000..da106a1550 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: {} +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js new file mode 100644 index 0000000000..85b5f8c000 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: '' +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js new file mode 100644 index 0000000000..64f09d0da9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]: Symbol.asyncIterator +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js new file mode 100644 index 0000000000..270f0300ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var calls = 0; +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw reason; + }, + get [Symbol.asyncIterator]() { + calls += 1; + return null; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + assert.sameValue(calls, 1); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js new file mode 100644 index 0000000000..ac3d3b5fcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while calling [Symbol.asyncIterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js new file mode 100644 index 0000000000..0f4880b0c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - boolean (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return true; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js new file mode 100644 index 0000000000..2aaec3d97c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-null-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - null (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return null; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js new file mode 100644 index 0000000000..2d097d12e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-number-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - number (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return 42; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js new file mode 100644 index 0000000000..c811757e67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-string-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - string (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return '42'; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js new file mode 100644 index 0000000000..7f51b55cc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - symbol (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return Symbol.asyncIterator; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js new file mode 100644 index 0000000000..748e27eff0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - undefined (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + ... + 6. Let iterator be ? Call(method, obj). + 7. If Type(iterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return undefined; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js new file mode 100644 index 0000000000..b3d7c2fe65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var calls = 0; +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw reason; + }, + get [Symbol.asyncIterator]() { + calls += 1; + return undefined; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + assert.sameValue(calls, 1); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js new file mode 100644 index 0000000000..465827a071 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting [Symbol.iterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js new file mode 100644 index 0000000000..571fbc8120 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: false +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js new file mode 100644 index 0000000000..7957616217 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: 0 +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js new file mode 100644 index 0000000000..8ba9442178 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: {} +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js new file mode 100644 index 0000000000..f8fe339b06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: '' +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js new file mode 100644 index 0000000000..50f9b47d3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ... + + GetMethod ( V, P ) + + ... + 2. Let func be ? GetV(V, P). + ... + 4. If IsCallable(func) is false, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]: Symbol.iterator +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js new file mode 100644 index 0000000000..7a7fff3a80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js @@ -0,0 +1,87 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while calling [Symbol.iterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + ... + +---*/ +var reason = {}; +var obj = { + [Symbol.iterator]() { + throw reason; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js new file mode 100644 index 0000000000..a543a2ac47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - boolean (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return true; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js new file mode 100644 index 0000000000..b394a8346b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - null (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return null; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js new file mode 100644 index 0000000000..169cfe38c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - number (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return 0; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js new file mode 100644 index 0000000000..3ba382cca5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - string (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return ''; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js new file mode 100644 index 0000000000..a59eb2a579 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - symbol (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return Symbol.iterator; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js new file mode 100644 index 0000000000..f0fdf55a7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - undefined (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + CreateAsyncFromSyncIterator(syncIterator) + + 1. If Type(syncIterator) is not Object, throw a TypeError exception. + ... + +---*/ +var obj = { + [Symbol.iterator]() { + return undefined; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js new file mode 100644 index 0000000000..330b7063ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-done-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting done (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + v. Let done be ? IteratorComplete(innerResult). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + get done() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js new file mode 100644 index 0000000000..18dda59a3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js @@ -0,0 +1,85 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-returns-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while calling next (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + throw reason; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js new file mode 100644 index 0000000000..bb15467078 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js @@ -0,0 +1,95 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-value-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + vi. If done is true, then + 1. Return ? IteratorValue(innerResult). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + done: true, + get value() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js new file mode 100644 index 0000000000..89d77cd05b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js @@ -0,0 +1,85 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Abrupt completion while getting next (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + get next() { + throw reason; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, "reject reason"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js new file mode 100644 index 0000000000..4c7cee0b64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js @@ -0,0 +1,105 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-non-object-ignores-then.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: If next() value is not-object, do not access respective then property (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + +---*/ +Number.prototype.then = function() { + throw new Test262Error('Number#then should not be used'); +}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return 42; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, 'TypeError'); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js new file mode 100644 index 0000000000..08c1629ac8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-boolean-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Not-callable next value in a yield star position - boolean (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: true + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js new file mode 100644 index 0000000000..1ab7422ad3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-null-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Not-callable next value in a yield star position - null (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: null + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js new file mode 100644 index 0000000000..6e7a5e3e5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-number-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Not-callable next value in a yield star position - number (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: 42 + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js new file mode 100644 index 0000000000..50d72f6c85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-object-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Not-callable next value in a yield star position - object (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: {} + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js new file mode 100644 index 0000000000..473355adde --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-string-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Not-callable next value in a yield star position - string (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: '' + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js new file mode 100644 index 0000000000..e9f65a126c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-symbol-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Not-callable next value in a yield star position - symbol (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: Symbol('oi') + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js new file mode 100644 index 0000000000..8c2cf29b05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-not-callable-undefined-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Not-callable next value in a yield star position - undefined (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next: undefined + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v.constructor, TypeError, "TypeError"); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js new file mode 100644 index 0000000000..c0b9bd1a9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-get-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Return abrupt after getting next().then (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 8. Let then be Get(resolution, "then"). + ... + 10. Get thenAction be then.[[Value]]. + ... + 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise, + resolution, thenAction »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + get then() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js new file mode 100644 index 0000000000..e9301e29e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (boolean) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: true, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js new file mode 100644 index 0000000000..322702eb21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (null) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: null, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js new file mode 100644 index 0000000000..e206e1d422 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (number) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: 39, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js new file mode 100644 index 0000000000..f99a70eb8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (object) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: {}, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js new file mode 100644 index 0000000000..05ffe54dd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (string) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: '', + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js new file mode 100644 index 0000000000..d15ddd974e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (symbol) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: Symbol('oi'), + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js new file mode 100644 index 0000000000..cc5799e89f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: FulfillPromise if next().then is not-callable (undefined) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + iv. If Type(innerResult) is not Object, throw a TypeError exception. + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 7. If Type(resolution) is not Object, then + a. Return FulfillPromise(promise, resolution). + 8. Let then be Get(resolution, "then"). + ... + 11. If IsCallable(thenAction) is false, then + a. Return FulfillPromise(promise, resolution). + ... + +---*/ +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then: undefined, + value: 42, + done: false + } + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js new file mode 100644 index 0000000000..f116feff0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-returns-abrupt.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: Return abrupt after calling next().then (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + ... + 6. Repeat + a. If received.[[Type]] is normal, then + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + + Await + + ... + 2. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »). + ... + + Promise Resolve Functions + + ... + 8. Let then be Get(resolution, "then"). + ... + 10. Get thenAction be then.[[Value]]. + ... + 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise, + resolution, thenAction »). + ... + +---*/ +var reason = {}; +var obj = { + get [Symbol.iterator]() { + throw new Test262Error('it should not get Symbol.iterator'); + }, + [Symbol.asyncIterator]() { + return { + next() { + return { + then() { + throw reason; + } + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next().then(() => { + throw new Test262Error('Promise incorrectly fulfilled.'); +}, v => { + assert.sameValue(v, reason, 'reject reason'); + + iter.next().then(({ done, value }) => { + assert.sameValue(done, true, 'the iterator is completed'); + assert.sameValue(value, undefined, 'value is undefined'); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-next.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-next.js new file mode 100644 index 0000000000..3508e1b76e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-next.js @@ -0,0 +1,242 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-next.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: execution order for yield* with sync iterator and next() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 2. Let value be ? GetValue(exprRef). + 3. Let generatorKind be ! GetGeneratorKind(). + 4. Let iterator be ? GetIterator(value, generatorKind). + 5. Let received be NormalCompletion(undefined). + 6. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + ii. Let innerResult be ? Invoke(iterator, "next", + « received.[[Value]] »). + iii. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + v. Let done be ? IteratorComplete(innerResult). + vi. If done is true, then + 1. Return ? IteratorValue(innerResult). + vii. Let received be GeneratorYield(innerResult). + ... + + GetIterator ( obj [ , hint ] ) + + ... + 3. If hint is async, + a. Set method to ? GetMethod(obj, @@asyncIterator). + b. If method is undefined, + i. Let syncMethod be ? GetMethod(obj, @@iterator). + ii. Let syncIterator be ? Call(syncMethod, obj). + iii. Return ? CreateAsyncFromSyncIterator(syncIterator). + ... + + %AsyncFromSyncIteratorPrototype%.next ( value ) + + ... + 5. Let nextResult be IteratorNext(syncIterator, value). + ... + 7. Let nextValue be IteratorValue(nextResult). + ... + 9. Let nextDone be IteratorComplete(nextResult). + ... + 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, + « nextValue »). + ... + 14. Set onFulfilled.[[Done]] to nextDone. + 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]], + onFulfilled, undefined, promiseCapability). + ... + + Async Iterator Value Unwrap Functions + + 1. Return ! CreateIterResultObject(value, F.[[Done]]). + +---*/ +var log = []; +var obj = { + get [Symbol.iterator]() { + log.push({ + name: "get [Symbol.iterator]", + thisValue: this + }); + return function() { + log.push({ + name: "call [Symbol.iterator]", + thisValue: this, + args: [...arguments] + }); + var nextCount = 0; + return { + name: "syncIterator", + get next() { + log.push({ + name: "get next", + thisValue: this + }); + return function() { + log.push({ + name: "call next", + thisValue: this, + args: [...arguments] + }); + + nextCount++; + if (nextCount == 1) { + return { + name: "next-result-1", + get value() { + log.push({ + name: "get next value (1)", + thisValue: this + }); + return "next-value-1"; + }, + get done() { + log.push({ + name: "get next done (1)", + thisValue: this + }); + return false; + } + }; + } + + return { + name: "next-result-2", + get value() { + log.push({ + name: "get next value (2)", + thisValue: this + }); + return "next-value-2"; + }, + get done() { + log.push({ + name: "get next done (2)", + thisValue: this + }); + return true; + } + }; + }; + } + }; + }; + }, + get [Symbol.asyncIterator]() { + log.push({ name: "get [Symbol.asyncIterator]" }); + return null; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next("next-arg-1").then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get [Symbol.asyncIterator]"); + + assert.sameValue(log[2].name, "get [Symbol.iterator]"); + assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue"); + + assert.sameValue(log[3].name, "call [Symbol.iterator]"); + assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue"); + assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length"); + + assert.sameValue(log[4].name, "get next"); + assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue"); + + assert.sameValue(log[5].name, "call next"); + assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue"); + assert.sameValue(log[5].args.length, 1, "next args.length"); + assert.sameValue(log[5].args[0], undefined, "next args[0]"); + + assert.sameValue(log[6].name, "get next done (1)"); + assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue"); + + assert.sameValue(log[7].name, "get next value (1)"); + assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 8, "log.length"); + + iter.next("next-arg-2").then(v => { + assert.sameValue(log[8].name, "call next"); + assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue"); + assert.sameValue(log[8].args.length, 1, "next args.length"); + assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]"); + + assert.sameValue(log[9].name, "get next done (2)"); + assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue"); + + assert.sameValue(log[10].name, "get next value (2)"); + assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue"); + + assert.sameValue(log[11].name, "after yield*"); + assert.sameValue(log[11].value, "next-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 12, "log.length"); + }).then($DONE, $DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-return.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-return.js new file mode 100644 index 0000000000..10e2d61c6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-return.js @@ -0,0 +1,217 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-return.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: execution order for yield* with sync iterator and return() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). + iii. If return is undefined, return Completion(received). + iv. Let innerReturnResult be ? Call(return, iterator, + « received.[[Value]] »). + v. If generatorKind is async, then set innerReturnResult to + ? Await(innerReturnResult). + ... + vii. Let done be ? IteratorComplete(innerReturnResult). + viii. If done is true, then + 1. Let value be ? IteratorValue(innerReturnResult). + 2. Return Completion{[[Type]]: return, [[Value]]: value, + [[Target]]: empty}. + ix. Let received be GeneratorYield(innerResult). + + %AsyncFromSyncIteratorPrototype%.return ( value ) + + 5. Let return be GetMethod(syncIterator, "return"). + ... + ... + 8. Let returnResult be Call(return, syncIterator, « value »). + ... + 11. Let returnValue be IteratorValue(returnResult). + .. + 13. Let returnDone be IteratorComplete(returnResult). + ... + 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »). + ... + 18. Set onFulfilled.[[Done]] to returnDone. + 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]], + onFulfilled, undefined, promiseCapability). + ... + +---*/ +var log = []; +var obj = { + [Symbol.iterator]() { + var returnCount = 0; + return { + name: "syncIterator", + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get return() { + log.push({ + name: "get return", + thisValue: this + }); + return function() { + log.push({ + name: "call return", + thisValue: this, + args: [...arguments] + }); + + returnCount++; + if (returnCount == 1) { + return { + name: "return-result-1", + get value() { + log.push({ + name: "get return value (1)", + thisValue: this + }); + return "return-value-1"; + }, + get done() { + log.push({ + name: "get return done (1)", + thisValue: this + }); + return false; + } + }; + } + + return { + name: "return-result-2", + get value() { + log.push({ + name: "get return value (2)", + thisValue: this + }); + return "return-value-2"; + }, + get done() { + log.push({ + name: "get return done (2)", + thisValue: this + }); + return true; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.return("return-arg-1").then(v => { + assert.sameValue(log[2].name, "get return"); + assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue"); + + assert.sameValue(log[3].name, "call return"); + assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue"); + assert.sameValue(log[3].args.length, 1, "return args.length"); + assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]"); + + assert.sameValue(log[4].name, "get return done (1)"); + assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue"); + + assert.sameValue(log[5].name, "get return value (1)"); + assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 6, "log.length"); + + iter.return().then(v => { + assert.sameValue(log[6].name, "get return"); + assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue"); + + assert.sameValue(log[7].name, "call return"); + assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue"); + assert.sameValue(log[7].args.length, 1, "return args.length"); + assert.sameValue(log[7].args[0], undefined, "return args[0]"); + + assert.sameValue(log[8].name, "get return done (2)"); + assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue"); + + assert.sameValue(log[9].name, "get return value (2)"); + assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue"); + + assert.sameValue(v.value, "return-value-2"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 10, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-throw.js b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-throw.js new file mode 100644 index 0000000000..779dc10eff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-throw.js @@ -0,0 +1,223 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-throw.case +// - src/async-generators/default/async-class-expr-private-method.template +/*--- +description: execution order for yield* with sync iterator and throw() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorPrivateMethod +features: [Symbol.iterator, async-iteration, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + YieldExpression: yield * AssignmentExpression + + ... + 6. Repeat + ... + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »). + 2. If generatorKind is async, then set innerResult to + ? Await(innerResult). + ... + 5. Let done be ? IteratorComplete(innerResult). + 6. If done is true, then + a. Return ? IteratorValue(innerResult). + 7. Let received be GeneratorYield(innerResult). + ... + + %AsyncFromSyncIteratorPrototype%.throw ( value ) + + ... + 5. Let throw be GetMethod(syncIterator, "throw"). + ... + 8. Let throwResult be Call(throw, syncIterator, « value »). + ... + 11. Let throwValue be IteratorValue(throwResult). + ... + 13. Let throwDone be IteratorComplete(throwResult). + ... + 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, + « throwValue »). + ... + 18. Set onFulfilled.[[Done]] to throwDone. + 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]], + onFulfilled, undefined, promiseCapability). + ... + +---*/ +var log = []; +var obj = { + [Symbol.iterator]() { + var throwCount = 0; + return { + name: "syncIterator", + get next() { + log.push({ name: "get next" }); + return function() { + return { + value: "next-value-1", + done: false + }; + }; + }, + get throw() { + log.push({ + name: "get throw", + thisValue: this + }); + return function() { + log.push({ + name: "call throw", + thisValue: this, + args: [...arguments] + }); + + throwCount++; + if (throwCount == 1) { + return { + name: "throw-result-1", + get value() { + log.push({ + name: "get throw value (1)", + thisValue: this + }); + return "throw-value-1"; + }, + get done() { + log.push({ + name: "get throw done (1)", + thisValue: this + }); + return false; + } + }; + } + + return { + name: "throw-result-2", + get value() { + log.push({ + name: "get throw value (2)", + thisValue: this + }); + return "throw-value-2"; + }, + get done() { + log.push({ + name: "get throw done (2)", + thisValue: this + }); + return true; + } + }; + }; + } + }; + } +}; + + + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +assert.sameValue(log.length, 0, "log.length"); + +iter.next().then(v => { + assert.sameValue(log[0].name, "before yield*"); + + assert.sameValue(log[1].name, "get next"); + + assert.sameValue(v.value, "next-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 2, "log.length"); + + iter.throw("throw-arg-1").then(v => { + assert.sameValue(log[2].name, "get throw"); + assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue"); + + assert.sameValue(log[3].name, "call throw"); + assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue"); + assert.sameValue(log[3].args.length, 1, "throw args.length"); + assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]"); + + assert.sameValue(log[4].name, "get throw done (1)"); + assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue"); + + assert.sameValue(log[5].name, "get throw value (1)"); + assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue"); + + assert.sameValue(v.value, "throw-value-1"); + assert.sameValue(v.done, false); + + assert.sameValue(log.length, 6, "log.length"); + + iter.throw().then(v => { + assert.sameValue(log[6].name, "get throw"); + assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue"); + + assert.sameValue(log[7].name, "call throw"); + assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue"); + assert.sameValue(log[7].args.length, 1, "throw args.length"); + assert.sameValue(log[7].args[0], undefined, "throw args[0]"); + + assert.sameValue(log[8].name, "get throw done (2)"); + assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue"); + + assert.sameValue(log[9].name, "get throw value (2)"); + assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue"); + + assert.sameValue(log[10].name, "after yield*"); + assert.sameValue(log[10].value, "throw-value-2"); + + assert.sameValue(v.value, "return-value"); + assert.sameValue(v.done, true); + + assert.sameValue(log.length, 11, "log.length"); + }).then($DONE, $DONE); + }).catch($DONE); +}).catch($DONE); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..9bc5e94c95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier-escaped.case +// - src/async-functions/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + static async #method() { + var \u0061wait; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier.js new file mode 100644 index 0000000000..b3d9c43152 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-binding-identifier.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier.case +// - src/async-functions/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + static async #method() { + var await; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..ea148a0436 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference-escaped.case +// - src/async-functions/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + static async #method() { + void \u0061wait; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference.js new file mode 100644 index 0000000000..16dfd6380e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-identifier-reference.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference.case +// - src/async-functions/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + static async #method() { + void await; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..5bd10c80fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier-escaped.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier-escaped.case +// - src/async-functions/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + static async #method() { + \u0061wait: ; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier.js new file mode 100644 index 0000000000..13f4284bf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/await-as-label-identifier.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier.case +// - src/async-functions/syntax/async-class-expr-static-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + static async #method() { + await: ; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/browser.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js new file mode 100644 index 0000000000..3a0aa0a415 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case +// - src/async-functions/evaluation/async-class-expr-static-private-method.template +/*--- +description: Async function returns an async function. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + static async #method(x) { + let a = arguments; + return async () => a === arguments; + } + static async method(x) { + return this.#method(x); + } +} +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method.bind(C); + +asyncFn().then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, true); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js new file mode 100644 index 0000000000..da386a81dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow-returns-newtarget.case +// - src/async-functions/evaluation/async-class-expr-static-private-method.template +/*--- +description: Async function returns an async function. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + static async #method(x) { + return async () => new.target; + } + static async method(x) { + return this.#method(x); + } +} +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method.bind(C); + +asyncFn().then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, undefined); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow.js new file mode 100644 index 0000000000..fa0b079bf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow.case +// - src/async-functions/evaluation/async-class-expr-static-private-method.template +/*--- +description: Async function returns an async function. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + static async #method(x) { + return async () => x; + } + static async method(x) { + return this.#method(x); + } +} +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method.bind(C); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, 1); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js new file mode 100644 index 0000000000..1929855d7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case +// - src/async-functions/evaluation/async-class-expr-static-private-method.template +/*--- +description: Async function returns an async function. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + static async #method(x) { + let a = arguments; + return async function() { return a === arguments; }; + } + static async method(x) { + return this.#method(x); + } +} +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method.bind(C); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, false); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js new file mode 100644 index 0000000000..9d4b4cc4c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function-returns-newtarget.case +// - src/async-functions/evaluation/async-class-expr-static-private-method.template +/*--- +description: Async function returns an async function. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + static async #method(x) { + return async function() { return new.target; }; + } + static async method(x) { + return this.#method(x); + } +} +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method.bind(C); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, undefined); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function.js new file mode 100644 index 0000000000..2c4c55817c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function.case +// - src/async-functions/evaluation/async-class-expr-static-private-method.template +/*--- +description: Async function returns an async function. (Static private async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-static-methods-private] +flags: [generated, async] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + static async #method(x) { + return async function() { return x; }; + } + static async method(x) { + return this.#method(x); + } +} +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method.bind(C); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, 1); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/shell.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..9f68e2f746 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier-escaped.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier-escaped.case +// - src/async-functions/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + async #method() { + var \u0061wait; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier.js new file mode 100644 index 0000000000..fe25ad9e37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier.case +// - src/async-functions/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + async #method() { + var await; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..34306861de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference-escaped.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference-escaped.case +// - src/async-functions/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + async #method() { + void \u0061wait; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference.js new file mode 100644 index 0000000000..74894d7836 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference.case +// - src/async-functions/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + async #method() { + void await; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..4ec0f19a5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier-escaped.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier-escaped.case +// - src/async-functions/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + async #method() { + \u0061wait: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier.js new file mode 100644 index 0000000000..c5038b9029 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier.case +// - src/async-functions/syntax/async-class-expr-private-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var C = class { + async #method() { + await: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/browser.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js new file mode 100644 index 0000000000..ddb58cd675 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case +// - src/async-functions/evaluation/async-class-expr-private-method.template +/*--- +description: Async function returns an async function. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + async #method(x) { + let a = arguments; + return async () => a === arguments; + } + async method(x) { + return this.#method(x); + } +}; +// Stores a reference `asyncFn` for case evaluation +let c = new C(); +let asyncFn = c.method.bind(c); + +asyncFn().then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, true); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js new file mode 100644 index 0000000000..125099117c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow-returns-newtarget.case +// - src/async-functions/evaluation/async-class-expr-private-method.template +/*--- +description: Async function returns an async function. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + async #method(x) { + return async () => new.target; + } + async method(x) { + return this.#method(x); + } +}; +// Stores a reference `asyncFn` for case evaluation +let c = new C(); +let asyncFn = c.method.bind(c); + +asyncFn().then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, undefined); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow.js new file mode 100644 index 0000000000..e939b621b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow.case +// - src/async-functions/evaluation/async-class-expr-private-method.template +/*--- +description: Async function returns an async function. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + async #method(x) { + return async () => x; + } + async method(x) { + return this.#method(x); + } +}; +// Stores a reference `asyncFn` for case evaluation +let c = new C(); +let asyncFn = c.method.bind(c); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, 1); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js new file mode 100644 index 0000000000..5d3fdf72e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case +// - src/async-functions/evaluation/async-class-expr-private-method.template +/*--- +description: Async function returns an async function. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + async #method(x) { + let a = arguments; + return async function() { return a === arguments; }; + } + async method(x) { + return this.#method(x); + } +}; +// Stores a reference `asyncFn` for case evaluation +let c = new C(); +let asyncFn = c.method.bind(c); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, false); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-newtarget.js new file mode 100644 index 0000000000..09ec06ea7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function-returns-newtarget.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function-returns-newtarget.case +// - src/async-functions/evaluation/async-class-expr-private-method.template +/*--- +description: Async function returns an async function. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + async #method(x) { + return async function() { return new.target; }; + } + async method(x) { + return this.#method(x); + } +}; +// Stores a reference `asyncFn` for case evaluation +let c = new C(); +let asyncFn = c.method.bind(c); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, undefined); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function.js new file mode 100644 index 0000000000..986a60c5a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function.case +// - src/async-functions/evaluation/async-class-expr-private-method.template +/*--- +description: Async function returns an async function. (Async private method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var C = class { + async #method(x) { + return async function() { return x; }; + } + async method(x) { + return this.#method(x); + } +}; +// Stores a reference `asyncFn` for case evaluation +let c = new C(); +let asyncFn = c.method.bind(c); + +asyncFn(1).then(retFn => { + count++; + return retFn(); +}).then(result => { + assert.sameValue(result, 1); + assert.sameValue(count, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/async-private-method/shell.js b/js/src/tests/test262/language/expressions/class/elements/async-private-method/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/browser.js b/js/src/tests/test262/language/expressions/class/elements/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-anonymous.js b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-anonymous.js new file mode 100644 index 0000000000..33c989b567 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-anonymous.js @@ -0,0 +1,28 @@ +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The inferred class-name is present when executing static field initializers of anonymous class expressions. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +features: [class-static-fields-public] +---*/ + +var className; + +var C = class { + static f = (className = this.name); +} + +assert.sameValue(className, "C"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-decl.js b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-decl.js new file mode 100644 index 0000000000..5b7ceee987 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-decl.js @@ -0,0 +1,28 @@ +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The class-name is present when executing static field initializers of class declarations. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +features: [class-static-fields-public] +---*/ + +var className; + +class C { + static f = (className = this.name); +} + +assert.sameValue(className, "C"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-default-export.js b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-default-export.js new file mode 100644 index 0000000000..88ed40b12a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-default-export.js @@ -0,0 +1,30 @@ +// |reftest| module +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The class-name is present when executing static field initializers of default-exported classes. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +flags: [module] +features: [class-static-fields-public] +---*/ + +var className; + +export default class { + static f = (className = this.name); +} + +assert.sameValue(className, "default"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-expr.js b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-expr.js new file mode 100644 index 0000000000..18e743e2bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-expr.js @@ -0,0 +1,28 @@ +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The class-name is present when executing static field initializers of named class expressions. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +features: [class-static-fields-public] +---*/ + +var className; + +var expr = class C { + static f = (className = this.name); +} + +assert.sameValue(className, "C"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..8cefd0f92d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-arguments.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-comp-name.template +/*--- +description: Syntax error if `arguments` used in class field (computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + [x] = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-super.js new file mode 100644 index 0000000000..396462cffd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/comp-name-init-err-contains-super.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-comp-name.template +/*--- +description: Syntax error if `super()` used in class field (computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + [x] = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive-symbol.js b/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive-symbol.js new file mode 100644 index 0000000000..00e0c7856d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive-symbol.js @@ -0,0 +1,105 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-toprimitive-symbol.case +// - src/class-elements/default/cls-expr.template +/*--- +description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, Symbol.toPrimitive, Symbol, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +var s1 = Symbol(); +var s2 = Symbol(); +var s3 = Symbol(); +var err = function() { throw new Test262Error(); }; +var obj1 = { + [Symbol.toPrimitive]: function() { return s1; }, + toString: err, + valueOf: err +}; + +var obj2 = { + toString: function() { return s2; }, + valueOf: err +}; + +var obj3 = { + toString: undefined, + valueOf: function() { return s3; } +}; + + + +var C = class { + [obj1] = 42; + [obj2] = 43; + [obj3] = 44; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, s1), false); +assert.sameValue(Object.hasOwnProperty.call(C, s1), false); + +verifyProperty(c, s1, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, s2), false); +assert.sameValue(Object.hasOwnProperty.call(C, s2), false); + +verifyProperty(c, s2, { + value: 43, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, s3), false); +assert.sameValue(Object.hasOwnProperty.call(C, s3), false); + +verifyProperty(c, s3, { + value: 44, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive.js b/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive.js new file mode 100644 index 0000000000..6d14feebe7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-toprimitive.case +// - src/class-elements/default/cls-expr.template +/*--- +description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +var err = function() { throw new Test262Error(); }; +var obj1 = { + [Symbol.toPrimitive]: function() { return "d"; }, + toString: err, + valueOf: err +}; + +var obj2 = { + toString: function() { return "e"; }, + valueOf: err +}; + +var obj3 = { + toString: undefined, + valueOf: function() { return "f"; } +}; + + + +var C = class { + [obj1] = 42; + [obj2] = 43; + [obj3] = 44; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "e"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "e"), false); + +verifyProperty(c, "e", { + value: 43, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "f"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "f"), false); + +verifyProperty(c, "f", { + value: 44, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/ctor-called-after-fields-init.js b/js/src/tests/test262/language/expressions/class/elements/ctor-called-after-fields-init.js new file mode 100644 index 0000000000..ba0ec47400 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/ctor-called-after-fields-init.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/ctor-called-after-fields-init.case +// - src/class-elements/default/cls-expr.template +/*--- +description: The constructor method is called after the fields are initalized (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +info: | + [[Construct]] ( argumentsList, newTarget) + + 8. If kind is "base", then + a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument). + b. Let result be InitializeInstanceFields(thisArgument, F). + ... + ... + 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + ... + +---*/ +var ctor; + + +var C = class { + constructor() { + ctor = this.foo; + } + foo = 42; +} + +var c = new C(); + +assert.sameValue(ctor, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..a7e4f59cb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-1.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-eval.template +/*--- +description: super.x in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super.x;'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..043df175a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-contains-superproperty-2.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-eval.template +/*--- +description: super['x'] in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super["x"];'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..566cb44a62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval.template +/*--- +description: error if `super()['x']` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..c435851eca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval.template +/*--- +description: error if `super().x` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall.js new file mode 100644 index 0000000000..5e78ae5e4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-direct-eval-err-contains-supercall.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval.template +/*--- +description: error if `super()` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..7a035c6702 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-indirect-eval.template +/*--- +description: super.x in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super.x;'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..02669f2f34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-indirect-eval.template +/*--- +description: super['x'] in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super["x"];'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..a78841fb21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval.template +/*--- +description: error if `super()['x']` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..5e45a4171e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval.template +/*--- +description: error if `super().x` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall.js new file mode 100644 index 0000000000..48df895d33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/derived-cls-indirect-eval-err-contains-supercall.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval.template +/*--- +description: error if `super()` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-arguments.js new file mode 100644 index 0000000000..d5c6149b02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-arguments.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-arguments.case +// - src/class-elements/initializer-direct-eval-arguments/cls-expr-fields-eval.template +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + It is a Syntax Error if ContainsArguments of StatementList is true. + ... + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +var executed = false; +var C = class { + x = eval('executed = true; arguments;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..2319f80f0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/direct-eval-err-contains-newtarget.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-fields-eval.template +/*--- +description: error if `new.target` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + x = eval('executed = true; new.target;'); +} + +var c = new C(); + +assert.sameValue(executed, true); +assert.sameValue(c.x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-arguments.js new file mode 100644 index 0000000000..fdf3b36a1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-equality.template +/*--- +description: Syntax error if `arguments` used in class field (equality expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = {} == arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-super.js new file mode 100644 index 0000000000..cac4a45c55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/equality-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-equality.template +/*--- +description: Syntax error if `super()` used in class field (equality expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = {} == super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/browser.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-referenceerror.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-referenceerror.js new file mode 100644 index 0000000000..001be0e567 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-referenceerror.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-referenceerror.case +// - src/class-elements/class-evaluation-error/cls-expr.template +/*--- +description: ReferenceError evaluating a computed property name (field definitions in a class expression) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class-fields-public, computed-property-names, class] +flags: [generated] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +function fn() { + throw new Test262Error(); +} + + + +function evaluate() { + var C = class { + [noRef] = fn(); + }; +} + +assert.throws(ReferenceError, evaluate); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-err.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-err.js new file mode 100644 index 0000000000..1ca2127180 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-toprimitive-err.case +// - src/class-elements/class-evaluation-error/cls-expr.template +/*--- +description: Custom error evaluating a computed property name (field definitions in a class expression) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class] +flags: [generated] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +var obj = { + [Symbol.toPrimitive]: function() { + throw new Test262Error(); + } +}; + + + +function evaluate() { + var C = class { + [obj] + }; +} + +assert.throws(Test262Error, evaluate); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js new file mode 100644 index 0000000000..5b4acc4ca8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-toprimitive-returns-noncallable.case +// - src/class-elements/class-evaluation-error/cls-expr.template +/*--- +description: Custom error evaluating a computed property name (field definitions in a class expression) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class] +flags: [generated] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +var obj = { + [Symbol.toPrimitive]: {} +}; + + + +function evaluate() { + var C = class { + [obj] = refErrorIfEvaluated; + }; +} + +assert.throws(TypeError +, evaluate); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js new file mode 100644 index 0000000000..7a4c510072 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-toprimitive-returns-nonobject.case +// - src/class-elements/class-evaluation-error/cls-expr.template +/*--- +description: Custom error evaluating a computed property name (field definitions in a class expression) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class] +flags: [generated] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +var obj = { + [Symbol.toPrimitive]: 42 +}; + + + +function evaluate() { + var C = class { + [obj] = refErrorIfEvaluated; + }; +} + +assert.throws(TypeError, evaluate); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-tostring-err.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-tostring-err.js new file mode 100644 index 0000000000..86e27eee1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-tostring-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-tostring-err.case +// - src/class-elements/class-evaluation-error/cls-expr.template +/*--- +description: Custom error evaluating a computed property name (field definitions in a class expression) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class-fields-public, computed-property-names, class] +flags: [generated] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +var obj = { + toString: function() { + throw new Test262Error(); + } +}; + + + +function evaluate() { + var C = class { + [obj] + }; +} + +assert.throws(Test262Error +, evaluate); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-valueof-err.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-valueof-err.js new file mode 100644 index 0000000000..8bbcab078c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/computed-name-valueof-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-name-valueof-err.case +// - src/class-elements/class-evaluation-error/cls-expr.template +/*--- +description: Custom error evaluating a computed property name (field definitions in a class expression) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class-fields-public, computed-property-names, class] +flags: [generated] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of me is false, then + i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. + c. If fields is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. + iii. Return Completion(status). + ... + + Runtime Semantics: ClassElementEvaluation + + ClassElement: FieldDefinition; + Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. + + Runtime Semantics: ClassFieldDefinitionEvaluation + With parameters isStatic and homeObject. + + 1. Let fieldName be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(fieldName). + ... + + Runtime Semantics: Evaluation + ComputedPropertyName: [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + +---*/ +var obj = { + toString: undefined, + valueOf: function() { + throw new Test262Error(); + } +}; + + + +function evaluate() { + var C = class { + [obj] + }; +} + +assert.throws(Test262Error, evaluate); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/evaluation-error/shell.js b/js/src/tests/test262/language/expressions/class/elements/evaluation-error/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/field-declaration.js b/js/src/tests/test262/language/expressions/class/elements/field-declaration.js new file mode 100644 index 0000000000..ca1e5124c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/field-declaration.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/field-declaration.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Fields are defined (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + ClassDefinitionEvaluation: + ... + + 26. Let instanceFields be a new empty List. + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + i. Let field be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. ... + c. ... + d. If field is not empty, append field to instanceFields. + + ... + + 30. Set F.[[Fields]] to instanceFields. + ... + +---*/ +var computed = 'h'; + + +var C = class { + f = 'test262'; + 'g'; + 0 = 'bar'; + [computed]; +} + +let c = new C(); + +assert.sameValue(C.f, undefined); +assert.sameValue(C.g, undefined); +assert.sameValue(C.h, undefined); +assert.sameValue(C[0], undefined); + +assert.sameValue(Object.hasOwnProperty.call(C, 'f'), false); +assert.sameValue(Object.hasOwnProperty.call(C, 'g'), false); +assert.sameValue(Object.hasOwnProperty.call(C, 'h'), false); +assert.sameValue(Object.hasOwnProperty.call(C, 0), false); + +verifyProperty(c, 'f', { + value: 'test262', + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(c, 'g', { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(c, 0, { + value: 'bar', + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(c, 'h', { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-anonymous-function-length.js b/js/src/tests/test262/language/expressions/class/elements/fields-anonymous-function-length.js new file mode 100644 index 0000000000..309aadd38a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-anonymous-function-length.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/fields-anonymous-function-length.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Anonymous functions in field initializer have length properly set (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + FieldDefinition : + ClassElementName Initializer_opt + + InitializeInstanceFields ( O, constructor ) + 1. Assert: Type ( O ) is Object. + 2. Assert: constructor is an ECMAScript function object. + 3. Let fields be the value of constructor.[[Fields]]. + 4. For each item fieldRecord in order from fields, + a. Perform ? DefineField(O, fieldRecord). + 5. Return. + + DefineField(receiver, fieldRecord) + 1. Assert: Type(receiver) is Object. + 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. + 3. Let name be fieldRecord.[[Name]]. + 4. Let initializer be fieldRecord.[[Initializer]]. + 5. If initializer is not empty, then + a. Let initValue be ? Call(initializer, receiver). + ... + +---*/ + + +var C = class { + field = function() {}; + #field = (a, b, c, d) => undefined; + + accessPrivateField() { + return this.#field; + } +} + +let c = new C(); +assert.sameValue(c.accessPrivateField().length, 4); +assert.sameValue(c.field.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-asi-1.js b/js/src/tests/test262/language/expressions/class/elements/fields-asi-1.js new file mode 100644 index 0000000000..a49a7dd4a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-asi-1.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ASI test in field declarations -- computed name interpreted as property +esid: sec-automatic-semicolon-insertion +features: [class, class-fields-public] +---*/ + +var obj = {} +var C = class { + x = obj + ['lol'] = 42 +} + +var c = new C(); + +assert.sameValue(c.x, 42) +assert.sameValue(obj['lol'], 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-asi-2.js b/js/src/tests/test262/language/expressions/class/elements/fields-asi-2.js new file mode 100644 index 0000000000..2eca4bf63f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-asi-2.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ASI test in field declarations -- computed name interpreted as string index +esid: sec-automatic-semicolon-insertion +features: [class, class-fields-public] +---*/ + +var C = class { + x = "lol" + [1] +} + +var c = new C(); + +assert.sameValue(c.x, 'o'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-asi-3.js b/js/src/tests/test262/language/expressions/class/elements/fields-asi-3.js new file mode 100644 index 0000000000..6df7f18af8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-asi-3.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ASI test in field declarations -- error when computed name interpreted as index +esid: sec-automatic-semicolon-insertion +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = "string" + [0]() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-asi-4.js b/js/src/tests/test262/language/expressions/class/elements/fields-asi-4.js new file mode 100644 index 0000000000..92e457a9b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-asi-4.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ASI test in field declarations -- error when generator interpreted as multiplication +esid: sec-automatic-semicolon-insertion +features: [class, class-fields-public, generators] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = 42 + *gen() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-asi-5.js b/js/src/tests/test262/language/expressions/class/elements/fields-asi-5.js new file mode 100644 index 0000000000..60cf6a8468 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-asi-5.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ASI test in field declarations -- field with PropertyName "in" interpreted as index +esid: sec-automatic-semicolon-insertion +features: [class, class-fields-public] +---*/ + +var x = 0; +var y = 1; +var z = [42]; + +var C = class { + a = x + in + z + b = y + in + z +} + +var c = new C(); + +assert.sameValue(c.a, true, 'a = x in z'); +assert.sameValue(c.b, false, 'b = y in z'); +assert.sameValue(Object.hasOwnProperty.call(c, "in"), false, "'in'"); +assert.sameValue(Object.hasOwnProperty.call(c, "z"), false, "'z'"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-1.js b/js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-1.js new file mode 100644 index 0000000000..1b92ce650f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-1.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Jason Orendorff. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ASI test in field declarations -- error when method on same line +esid: sec-automatic-semicolon-insertion +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class { + field /* no ASI here */ method(){} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-2.js b/js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-2.js new file mode 100644 index 0000000000..5751f38c57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-asi-same-line-2.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Jason Orendorff. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ASI test in field declarations -- error when method on same line after initializer +esid: sec-automatic-semicolon-insertion +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class { + field = 1 /* no ASI here */ method(){} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-computed-name-static-propname-prototype.js b/js/src/tests/test262/language/expressions/class/elements/fields-computed-name-static-propname-prototype.js new file mode 100644 index 0000000000..3bf563aa25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-computed-name-static-propname-prototype.js @@ -0,0 +1,34 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: static class fields forbid PropName 'prototype' (no early error -- PropName of ComputedPropertyName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-static-fields-public] +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + ... + 16. Perform MakeConstructor(F, false, proto). + ... + + 9.2.10 MakeConstructor ( F [ , writablePrototype [ , prototype ] ] ) + + 6. Perform ! DefinePropertyOrThrow(F, "prototype", PropertyDescriptor { [[Value]]: prototype, + [[Writable]]: writablePrototype, [[Enumerable]]: false, [[Configurable]]: false }). +---*/ + +var x = "prototype"; + +assert.throws(TypeError, function() { + (0, class { + static [x] = 42; + }); +}); + +assert.throws(TypeError, function() { + (0, class { + static [x]; + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-duplicate-privatenames.js b/js/src/tests/test262/language/expressions/class/elements/fields-duplicate-privatenames.js new file mode 100644 index 0000000000..6882529c51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-duplicate-privatenames.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// Copyright 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Syntax error if the same private field defined twice +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries. +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + #x; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-propname-constructor.js b/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-propname-constructor.js new file mode 100644 index 0000000000..539bc22fb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-propname-constructor.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: class fields forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + LiteralPropertyName : IdentifierName + Return StringValue of IdentifierName. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : FieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "constructor". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + constructor; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-constructor.js b/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-constructor.js new file mode 100644 index 0000000000..4ab66878ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-constructor.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: static class field forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + LiteralPropertyName : IdentifierName + Return StringValue of IdentifierName. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static constructor; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-prototype.js b/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-prototype.js new file mode 100644 index 0000000000..57b75401b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-literal-name-static-propname-prototype.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: static class fields forbid PropName 'prototype' (early error -- PropName of IdentifierName is forbidden) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + LiteralPropertyName : IdentifierName + Return StringValue of IdentifierName. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static prototype; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js b/js/src/tests/test262/language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js new file mode 100644 index 0000000000..73005dca8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Static private methods not accessible via default Proxy handler +esid: prod-FieldDefinition +features: [class, class-static-methods-private] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x(value) { + return 1; + } + static x() { + return this.#x(); + } +} + +var P = new Proxy(C, {}); + +assert.sameValue(C.x(), 1); +assert.throws(TypeError, function() { + P.x(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-run-once-on-double-super.js b/js/src/tests/test262/language/expressions/class/elements/fields-run-once-on-double-super.js new file mode 100644 index 0000000000..5121028216 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-run-once-on-double-super.js @@ -0,0 +1,43 @@ +// Copyright (C) 2018 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword-runtime-semantics-evaluation +description: > + when calling `super()` for a second time in a derived class, the super constructor is run twice but the field initializers are only run once +info: | + [...] + 6. Let result be ? Construct(func, argList, newTarget). + [...] + 10. Perform ? thisER.BindThisValue(result). + 11. Perform ? InitializeInstanceFields(result, F). + [...] +features: [class-fields-public] +---*/ + + +var baseCtorCalled = 0; +var fieldInitCalled = 0; +class Base { + constructor() { + ++baseCtorCalled; + } +} + +var C = class extends Base { + field = ++fieldInitCalled; + constructor() { + assert.sameValue(baseCtorCalled, 0); + assert.sameValue(fieldInitCalled, 0); + super(); + assert.sameValue(baseCtorCalled, 1); + assert.sameValue(fieldInitCalled, 1); + assert.throws(ReferenceError, () => super()); + } +}; + +new C(); + +assert.sameValue(baseCtorCalled, 2); +assert.sameValue(fieldInitCalled, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-string-name-propname-constructor.js b/js/src/tests/test262/language/expressions/class/elements/fields-string-name-propname-constructor.js new file mode 100644 index 0000000000..78b22eb338 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-string-name-propname-constructor.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: class fields forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + ... + LiteralPropertyName : StringLiteral + Return the String value whose code units are the SV of the StringLiteral. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : FieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "constructor". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + 'constructor'; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-constructor.js b/js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-constructor.js new file mode 100644 index 0000000000..8971ec32ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-constructor.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: static class field forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + ... + LiteralPropertyName : StringLiteral + Return the String value whose code units are the SV of the StringLiteral. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static 'constructor'; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-prototype.js b/js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-prototype.js new file mode 100644 index 0000000000..9bcff628d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-string-name-static-propname-prototype.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: static class fields forbid PropName 'prototype' (early error -- PropName of StringLiteral is forbidden) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + ... + LiteralPropertyName : StringLiteral + Return the String value whose code units are the SV of the StringLiteral. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static 'prototype'; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/browser.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/shell.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..fcf32f758b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier-escaped.case +// - src/generators/syntax/class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class { static *#gen() { + var yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier.js new file mode 100644 index 0000000000..9fdcc8f96c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-binding-identifier.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier.case +// - src/generators/syntax/class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class { static *#gen() { + var yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..5ddaeeb8d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference-escaped.case +// - src/generators/syntax/class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class { static *#gen() { + void yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference.js new file mode 100644 index 0000000000..cb16f4c245 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-identifier-reference.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference.case +// - src/generators/syntax/class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class { static *#gen() { + void yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..72e84c4183 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier-escaped.case +// - src/generators/syntax/class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class { static *#gen() { + yi\u0065ld: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier.js new file mode 100644 index 0000000000..db2a5e0cb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-as-label-identifier.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier.case +// - src/generators/syntax/class-expr-static-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-static-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class { static *#gen() { + yield: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..cd6cd6107d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js @@ -0,0 +1,63 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/class-expr-static-private-method.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [object-spread, generators, class-static-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var C = class { + static *#gen() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..81fe417d6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-strict-strict.js @@ -0,0 +1,54 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/class-expr-static-private-method.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-static-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var C = class { + static *#gen() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..f2a70c1161 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js @@ -0,0 +1,62 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/class-expr-static-private-method.template +/*--- +description: Use yield value in a array spread position (Static generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-static-methods-private] +flags: [generated] +includes: [compareArray.js] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + +var callCount = 0; + +var C = class { + static *#gen() { + callCount += 1; + yield [...yield yield]; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next(false); +item = iter.next(['a', 'b', 'c']); +item = iter.next(item.value); + +assert(compareArray(item.value, arr)); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js new file mode 100644 index 0000000000..65aff8bf0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js @@ -0,0 +1,64 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/class-expr-static-private-method.template +/*--- +description: Use yield value in a array spread position (Static generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] +---*/ +var arr = ['a', 'b', 'c']; + +var callCount = 0; + +var C = class { + static *#gen() { + callCount += 1; + yield [...yield]; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next(false); +var item = iter.next(arr); +var value = item.value; + +assert.notSameValue(value, arr, 'value is a new array'); +assert(Array.isArray(value), 'value is an Array exotic object'); +assert.sameValue(value.length, 3) +assert.sameValue(value[0], 'a'); +assert.sameValue(value[1], 'b'); +assert.sameValue(value[2], 'c'); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js new file mode 100644 index 0000000000..df77a3bc9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js @@ -0,0 +1,67 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/class-expr-static-private-method.template +/*--- +description: Use yield value in a object spread position (Static generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [object-spread, generators, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + +var callCount = 0; + +var C = class { + static *#gen() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; + } + static get gen() { return this.#gen; } +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +var iter = C.gen(); + +iter.next(); +iter.next({ x: 42 }); +iter.next({ x: 'lol' }); +var item = iter.next({ y: 39 }); + +assert.sameValue(item.value.x, 42); +assert.sameValue(item.value.y, 39); +assert.sameValue(Object.keys(item.value).length, 2); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/browser.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/shell.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..72f6362fab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier-escaped.case +// - src/generators/syntax/class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class {*#gen() { + var yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier.js new file mode 100644 index 0000000000..a6aaccdc52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier.case +// - src/generators/syntax/class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class {*#gen() { + var yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..85cbcd244e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference-escaped.case +// - src/generators/syntax/class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class {*#gen() { + void yi\u0065ld; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference.js new file mode 100644 index 0000000000..baa4d0b057 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference.case +// - src/generators/syntax/class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class {*#gen() { + void yield; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..78e8706d36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier-escaped.case +// - src/generators/syntax/class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class {*#gen() { + yi\u0065ld: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier.js new file mode 100644 index 0000000000..ddac71bed8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier.case +// - src/generators/syntax/class-expr-private-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator private method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators, class-methods-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var C = class {*#gen() { + yield: ; +}}; diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..7a92addf85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js @@ -0,0 +1,67 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/class-expr-private-method.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [object-spread, generators, class-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var C = class { + *#gen() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..c398c6f9f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-strict-strict.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/class-expr-private-method.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var C = class { + *#gen() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..f0ad21cd20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js @@ -0,0 +1,66 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/class-expr-private-method.template +/*--- +description: Use yield value in a array spread position (Generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-methods-private] +flags: [generated] +includes: [compareArray.js] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + +var callCount = 0; + +var C = class { + *#gen() { + callCount += 1; + yield [...yield yield]; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(false); +item = iter.next(['a', 'b', 'c']); +item = iter.next(item.value); + +assert(compareArray(item.value, arr)); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-single.js new file mode 100644 index 0000000000..b9d2eaa2dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-single.js @@ -0,0 +1,68 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/class-expr-private-method.template +/*--- +description: Use yield value in a array spread position (Generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-methods-private] +flags: [generated] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] +---*/ +var arr = ['a', 'b', 'c']; + +var callCount = 0; + +var C = class { + *#gen() { + callCount += 1; + yield [...yield]; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(false); +var item = iter.next(arr); +var value = item.value; + +assert.notSameValue(value, arr, 'value is a new array'); +assert(Array.isArray(value), 'value is an Array exotic object'); +assert.sameValue(value.length, 3) +assert.sameValue(value[0], 'a'); +assert.sameValue(value[1], 'b'); +assert.sameValue(value[2], 'c'); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-obj.js new file mode 100644 index 0000000000..b25ae3f9a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-obj.js @@ -0,0 +1,71 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/class-expr-private-method.template +/*--- +description: Use yield value in a object spread position (Generator private method as a ClassExpression element) +esid: prod-GeneratorPrivateMethod +features: [object-spread, generators, class-methods-private] +flags: [generated] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + +var callCount = 0; + +var C = class { + *#gen() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(); +iter.next({ x: 42 }); +iter.next({ x: 'lol' }); +var item = iter.next({ y: 39 }); + +assert.sameValue(item.value.x, 42); +assert.sameValue(item.value.y, 39); +assert.sameValue(Object.keys(item.value).length, 2); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/grammar-private-field-optional-chaining.js b/js/src/tests/test262/language/expressions/class/elements/grammar-private-field-optional-chaining.js new file mode 100644 index 0000000000..85b8a6dc4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/grammar-private-field-optional-chaining.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-field-optional-chaining.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName after '?.' is valid syntax (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, optional-chaining, class] +flags: [generated] +info: | + Updated Productions + + OptionalChain[Yield, Await]: + `?.` `[` Expression[+In, ?Yield, ?Await] `]` + `?.` IdentifierName + `?.` Arguments[?Yield, ?Await] + `?.` TemplateLiteral[?Yield, ?Await, +Tagged] + `?.` PrivateIdentifier + +---*/ + + +var C = class { + #m = 'test262'; + + static access(obj) { + return obj?.#m; + } +} + +let c = new C(); + +assert.sameValue(C.access(c), 'test262'); + +assert.sameValue(C.access(null), undefined); +assert.sameValue(C.access(undefined), undefined); + +assert.throws(TypeError, function() { + C.access({}); +}, 'accessed private field from an ordinary object'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/indirect-eval-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/indirect-eval-contains-arguments.js new file mode 100644 index 0000000000..575b98ffd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/indirect-eval-contains-arguments.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-arguments.case +// - src/class-elements/initializer-indirect-eval-arguments/cls-expr-fields-indirect-eval.template +/*--- +description: No error if `arguments` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated, noStrict] +info: | + For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer" + (in #sec-performeval-rules-in-initializer) are NOT applicable. + +---*/ + + +var arguments = 1; +var executed = false; +var C = class { + x = (0, eval)('arguments;'); +} + +assert.sameValue(new C().x, arguments); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/indirect-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..2844b4a997 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/indirect-eval-err-contains-newtarget.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-fields-indirect-eval.template +/*--- +description: error if `new.target` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + x = (0, eval)('executed = true; new.target;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/init-err-evaluation.js b/js/src/tests/test262/language/expressions/class/elements/init-err-evaluation.js new file mode 100644 index 0000000000..ec68dde36c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/init-err-evaluation.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-evaluation.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Return abrupt completion evaluating the field initializer (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +info: | + [[Construct]] ( argumentsList, newTarget) + + 8. If kind is "base", then + a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument). + b. Let result be InitializeInstanceFields(thisArgument, F). + ... + ... + 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + ... + +---*/ +var x = 0; +function fn1() { x += 1; } +function fn2() { throw new Test262Error(); } + + +var C = class { + x = fn1(); + y = fn2(); + z = fn1(); +} + +assert.throws(Test262Error, function() { + new C(); +}); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/init-value-defined-after-class.js b/js/src/tests/test262/language/expressions/class/elements/init-value-defined-after-class.js new file mode 100644 index 0000000000..60bced7c00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/init-value-defined-after-class.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/init-value-defined-after-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: The initializer value is defined after the class evaluation (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + [[Construct]] ( argumentsList, newTarget) + + 8. If kind is "base", then + a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument). + b. Let result be InitializeInstanceFields(thisArgument, F). + ... + ... + 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + ... + +---*/ +var x = false; + + +var C = class { + [x] = x; +} + +var c1 = new C(); + +x = true; +var c2 = new C(); + +verifyProperty(c1, "false", { + value: false, + enumerable: true, + configurable: true, + writable: true, +}); +verifyProperty(c2, "false", { + value: true, + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c1.hasOwnProperty("true"), false); +assert.sameValue(c2.hasOwnProperty("true"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/init-value-incremental.js b/js/src/tests/test262/language/expressions/class/elements/init-value-incremental.js new file mode 100644 index 0000000000..c9a6a17f84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/init-value-incremental.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/init-value-incremental.case +// - src/class-elements/default/cls-expr.template +/*--- +description: The initializer value is defined during the class instatiation (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + 27. For each ClassElement e in order from elements + ... + d. Append to fieldRecords the elements of fields. + ... + 33. Let result be InitializeStaticFields(F). + ... + + [[Construct]] ( argumentsList, newTarget) + + 8. If kind is "base", then + a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument). + b. Let result be InitializeInstanceFields(thisArgument, F). + ... + ... + 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + ... + +---*/ +var x = 1; + + +var C = class { + [x++] = x++; + [x++] = x++; +} + +var c1 = new C(); +var c2 = new C(); + +verifyProperty(c1, "1", { + value: 3, + enumerable: true, + configurable: true, + writable: true, +}); + +verifyProperty(c1, "2", { + value: 4, + enumerable: true, + configurable: true, + writable: true, +}); + +verifyProperty(c2, "1", { + value: 5, + enumerable: true, + configurable: true, + writable: true, +}); + +verifyProperty(c2, "2", { + value: 6, + enumerable: true, + configurable: true, + writable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/intercalated-static-non-static-computed-fields.js b/js/src/tests/test262/language/expressions/class/elements/intercalated-static-non-static-computed-fields.js new file mode 100644 index 0000000000..4eda07a71a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/intercalated-static-non-static-computed-fields.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/intercalated-static-non-static-computed-fields.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Computed class fields are executed in the order they are delcared, regardless it is static or instance field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + i. Let field be the result of performing ClassElementEvaluation for e with arguments proto and false. + b. Else, + i. Let field be the result of performing PropertyDefinitionEvaluation for mClassElementEvaluation for e with arguments F and false. + c. If field is an abrupt completion, then + ... + d. If field is not empty, + i. If IsStatic of e is false, append field to instanceFields. + ii. Otherwise, append field to staticFields. + ... + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + ... + + [[Construct]] (argumentsList, newTarget) + ... + 8. If kind is "base", then + a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument). + b. Let result be InitializeInstanceFields(thisArgument, F). + c. If result is an abrupt completion, then + i. Remove calleeContext from execution context stack and restore callerContext as the running execution context. + ii. Return Completion(result). + +---*/ + +let i = 0; + + +var C = class { + [i++] = i++; + static [i++] = i++; + [i++] = i++; +} + +let c = new C(); + +// It is important to notice that static field initializer will run before any instance initializer +verifyProperty(c, "0", { + value: 4, + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(c, "2", { + value: 5, + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(C, "1", { + value: 3, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(i, 6); +assert.sameValue(c.hasOwnProperty('1'), false); +assert.sameValue(C.hasOwnProperty('0'), false); +assert.sameValue(C.hasOwnProperty('2'), false); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..93be9a1b6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-literal-name.template +/*--- +description: Syntax error if `arguments` used in class field (literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..f80644bbf4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/literal-name-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-literal-name.template +/*--- +description: Syntax error if `super()` used in class field (literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-names.js new file mode 100644 index 0000000000..d9260967ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-names.js @@ -0,0 +1,113 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Computed property names (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + foo = "foobar"; + m() { return 42 } + [x] = 42; [10] = "meep"; ["not initialized"] + m2() { return 39 } + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-symbol-names.js new file mode 100644 index 0000000000..8206844002 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-symbol-names.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Computed property symbol names (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + foo = "foobar"; + m() { return 42 } + [x]; [y] = 42 + m2() { return 39 } + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..3ee863d24d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,143 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: PrivateName Static Semantics, StringValue (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J; + m2() { return 39 } + bar = "barbaz"; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names-asi.js new file mode 100644 index 0000000000..eb00c86bfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names-asi.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Literal property names with ASI (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + a + b = 42; + m2() { return 39 } + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names.js new file mode 100644 index 0000000000..c61ddadeae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Literal property names (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + foo = "foobar"; + m() { return 42 } + a; b = 42; + c = fn + m2() { return 39 } + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-field-usage.js new file mode 100644 index 0000000000..453d42f56f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-field-usage.js @@ -0,0 +1,83 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: PrivateName CallExpression usage (private field) (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #m = 'test262'; + m2() { return 39 } + bar = "barbaz"; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-getter-usage.js new file mode 100644 index 0000000000..d5fa734a88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-getter-usage.js @@ -0,0 +1,83 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + get #m() { return 'test262'; } + m2() { return 39 } + bar = "barbaz"; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-usage.js new file mode 100644 index 0000000000..54d4201fac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-usage.js @@ -0,0 +1,83 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: PrivateName CallExpression usage (private method) (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #m() { return 'test262'; } + m2() { return 39 } + bar = "barbaz"; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-names.js new file mode 100644 index 0000000000..204ece356f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-names.js @@ -0,0 +1,105 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: private names (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #x; #y + m2() { return 39 } + bar = "barbaz"; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..5e12a6c3d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier-initializer.js @@ -0,0 +1,120 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid FieldDefinition (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1 + m2() { return 39 } + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier.js new file mode 100644 index 0000000000..f06cc9fcb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier.js @@ -0,0 +1,127 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid FieldDefinition (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J + m2() { return 39 } + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter-alt.js new file mode 100644 index 0000000000..b7c538bcd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter-alt.js @@ -0,0 +1,162 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName as private getter (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter.js new file mode 100644 index 0000000000..d4c9707d0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter.js @@ -0,0 +1,162 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName as private getter (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method-alt.js new file mode 100644 index 0000000000..14a70dd7b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method-alt.js @@ -0,0 +1,161 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName as private method (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method.js new file mode 100644 index 0000000000..adb638fdbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method.js @@ -0,0 +1,161 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName as private method (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter-alt.js new file mode 100644 index 0000000000..e0265c4097 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter-alt.js @@ -0,0 +1,161 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName as private setter (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } + + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter.js new file mode 100644 index 0000000000..7f402dc1cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter.js @@ -0,0 +1,161 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName as private setter (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } + + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..00ead76bf3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-alt.js @@ -0,0 +1,143 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..6d2709e4b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1 + m2() { return 39 } + bar = "barbaz"; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..661c991da6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1 + m2() { return 39 } + bar = "barbaz"; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier.js new file mode 100644 index 0000000000..19a4367713 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier.js @@ -0,0 +1,143 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J + m2() { return 39 } + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..a814011a38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,167 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + } + m2() { return 39 } + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..1c7515038c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,168 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + } + m2() { return 39 } + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..389aee45f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,167 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static AsyncMethod PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + } + m2() { return 39 } + bar = "barbaz"; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..ebafc2b497 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,168 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static AsyncMethod PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + } + m2() { return 39 } + bar = "barbaz"; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..1f7fd194d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,158 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static GeneratorMethod PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + } + m2() { return 39 } + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..b30fe19c2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,159 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static GeneratorMethod PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + } + m2() { return 39 } + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..b44b764d62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,156 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static Method PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + } + m2() { return 39 } + bar = "barbaz"; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..a24e437c24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js @@ -0,0 +1,156 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static Method PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + } + m2() { return 39 } + bar = "barbaz"; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..a318a17a89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + m2() { return 39 } + bar = "barbaz"; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..0c8c11f775 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + m2() { return 39 } + bar = "barbaz"; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..6326b9af8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + m2() { return 39 } + bar = "barbaz"; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..314270b09c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,138 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + m2() { return 39 } + bar = "barbaz"; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..8cd71eaaac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,138 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + m2() { return 39 } + bar = "barbaz"; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..7d8915aee6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,138 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1 + m2() { return 39 } + bar = "barbaz"; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..c2cb0b58df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: Valid Static PrivateName (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + m2() { return 39 } + bar = "barbaz"; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-fields.js new file mode 100644 index 0000000000..878eeaa6ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-fields.js @@ -0,0 +1,105 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: static private fields (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #x; static #y + m2() { return 39 } + bar = "barbaz"; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..90daad9bac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods-with-fields.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: static private methods with fields (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #xVal; static #yVal + m2() { return 39 } + bar = "barbaz"; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods.js new file mode 100644 index 0000000000..65c5738915 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: static private methods (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + + m2() { return 39 } + bar = "barbaz"; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-string-literal-names.js new file mode 100644 index 0000000000..1f44c17cc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-string-literal-names.js @@ -0,0 +1,118 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-multiple-definitions.template +/*--- +description: String literal names (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + 'a'; "b"; 'c' = 39; + "d" = 42 + m2() { return 39 } + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-names.js new file mode 100644 index 0000000000..cd2f483356 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-names.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Computed property names (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + [x] = 42; [10] = "meep"; ["not initialized"] + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-symbol-names.js new file mode 100644 index 0000000000..002490ebdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-symbol-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Computed property symbol names (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..52750054a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: PrivateName Static Semantics, StringValue (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J; + foo = "foobar" + bar = "barbaz"; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names-asi.js new file mode 100644 index 0000000000..cd6c5d3d6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names-asi.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Literal property names with ASI (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42; + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names.js new file mode 100644 index 0000000000..759d3df62a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Literal property names (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-field-usage.js new file mode 100644 index 0000000000..9ca406b482 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-field-usage.js @@ -0,0 +1,61 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: PrivateName CallExpression usage (private field) (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = 'test262'; + foo = "foobar" + bar = "barbaz"; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-getter-usage.js new file mode 100644 index 0000000000..054a68255a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-getter-usage.js @@ -0,0 +1,61 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; } + foo = "foobar" + bar = "barbaz"; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-usage.js new file mode 100644 index 0000000000..fec844e0c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-usage.js @@ -0,0 +1,61 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: PrivateName CallExpression usage (private method) (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; } + foo = "foobar" + bar = "barbaz"; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-names.js new file mode 100644 index 0000000000..6a37690ae4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-names.js @@ -0,0 +1,83 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: private names (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + #x; #y + foo = "foobar" + bar = "barbaz"; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..a0c042487d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid FieldDefinition (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1 + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier.js new file mode 100644 index 0000000000..458a8c1c0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier.js @@ -0,0 +1,105 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid FieldDefinition (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js new file mode 100644 index 0000000000..45391585a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js @@ -0,0 +1,140 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName as private getter (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter.js new file mode 100644 index 0000000000..53fb51871d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter.js @@ -0,0 +1,140 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName as private getter (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method-alt.js new file mode 100644 index 0000000000..53eb2abd0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method-alt.js @@ -0,0 +1,139 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName as private method (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method.js new file mode 100644 index 0000000000..eb1227986a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method.js @@ -0,0 +1,139 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName as private method (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js new file mode 100644 index 0000000000..83a97faddc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js @@ -0,0 +1,139 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName as private setter (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } + + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter.js new file mode 100644 index 0000000000..0567e734e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter.js @@ -0,0 +1,139 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName as private setter (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } + + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..d4cafd3602 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..b1934728a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,115 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1 + foo = "foobar" + bar = "barbaz"; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..3ac338d814 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js @@ -0,0 +1,115 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1 + foo = "foobar" + bar = "barbaz"; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js new file mode 100644 index 0000000000..5152aa0668 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J + foo = "foobar" + bar = "barbaz"; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..61621862dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + } + foo = "foobar" + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..c2240d8315 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,146 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + } + foo = "foobar" + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..da071627d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static AsyncMethod PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + } + foo = "foobar" + bar = "barbaz"; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..f391f6c4d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,146 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static AsyncMethod PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + } + foo = "foobar" + bar = "barbaz"; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..29835ccec2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static GeneratorMethod PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + } + foo = "foobar" + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..13d1729e84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static GeneratorMethod PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + } + foo = "foobar" + bar = "barbaz"; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..0ba69ecf81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,134 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static Method PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + } + foo = "foobar" + bar = "barbaz"; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..fe02ba6fde --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js @@ -0,0 +1,134 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static Method PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + } + foo = "foobar" + bar = "barbaz"; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..9f9b01bcaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + foo = "foobar" + bar = "barbaz"; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..c73e18b866 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + foo = "foobar" + bar = "barbaz"; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..a05b87ca62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + foo = "foobar" + bar = "barbaz"; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..e0eb495efd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,116 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + foo = "foobar" + bar = "barbaz"; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..cca07f6282 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,116 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + foo = "foobar" + bar = "barbaz"; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..03464083cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,116 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1 + foo = "foobar" + bar = "barbaz"; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..63810a905b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Valid Static PrivateName (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + foo = "foobar" + bar = "barbaz"; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-fields.js new file mode 100644 index 0000000000..13dd5d3543 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-fields.js @@ -0,0 +1,83 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: static private fields (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x; static #y + foo = "foobar" + bar = "barbaz"; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..bb0a59b197 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js @@ -0,0 +1,100 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: static private methods with fields (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal + foo = "foobar" + bar = "barbaz"; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods.js new file mode 100644 index 0000000000..37aed88f8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods.js @@ -0,0 +1,87 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: static private methods (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + + foo = "foobar" + bar = "barbaz"; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-string-literal-names.js new file mode 100644 index 0000000000..7bef09964e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-string-literal-names.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: String literal names (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42 + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-arguments.js new file mode 100644 index 0000000000..6d88dd8a55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-arguments.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-arrow-fnc-nested.template +/*--- +description: Syntax error if `arguments` used in class field (arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = () => { + var t = () => arguments; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-super.js new file mode 100644 index 0000000000..8029180d3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-arrow-fnc-init-err-contains-super.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-arrow-fnc-nested.template +/*--- +description: Syntax error if `super()` used in class field (arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = () => { + var t = () => super(); + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..67b7fa87dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-comp-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + [x] = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-super.js new file mode 100644 index 0000000000..f5363a56bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-comp-name-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-comp-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + [x] = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..faf9d55d95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-eval-nested.template +/*--- +description: super.x in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super.x;'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..c470bcaad9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-eval-nested.template +/*--- +description: super['x'] in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super["x"];'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..4083514977 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval-nested.template +/*--- +description: error if `super()['x']` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..d151738def --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval-nested.template +/*--- +description: error if `super().x` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js new file mode 100644 index 0000000000..f6c0ac7be6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-eval-nested.template +/*--- +description: error if `super()` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = eval('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..c9bcc42789 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-indirect-eval-nested.template +/*--- +description: super.x in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super.x;'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..808bf4e4f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-fields-indirect-eval-nested.template +/*--- +description: super['x'] in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super["x"];'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..21da0e7766 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval-nested.template +/*--- +description: error if `super()['x']` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..4c93e29fae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval-nested.template +/*--- +description: error if `super().x` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js new file mode 100644 index 0000000000..c567ff5c21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-fields-indirect-eval-nested.template +/*--- +description: error if `super()` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + x = (0, eval)('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-arguments.js new file mode 100644 index 0000000000..40f88d6d9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-arguments.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-arguments.case +// - src/class-elements/initializer-direct-eval-arguments/cls-expr-fields-eval-nested.template +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + It is a Syntax Error if ContainsArguments of StatementList is true. + ... + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +let executed = false; +let C = class { + x = () => { + let f = eval('executed = true; arguments;'); + f(); + } +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..d0ebf9bb92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-direct-eval-err-contains-newtarget.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-fields-eval-nested.template +/*--- +description: error if `new.target` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + x = eval('executed = true; new.target;'); +} + +var c = new C(); + +assert.sameValue(executed, true); +assert.sameValue(c.x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-arguments.js new file mode 100644 index 0000000000..440c94c8a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-equality-nested.template +/*--- +description: Syntax error if `arguments` used in class field (equality expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => {} == arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-super.js new file mode 100644 index 0000000000..fad1183367 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-equality-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-equality-nested.template +/*--- +description: Syntax error if `super()` used in class field (equality expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => {} == super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-contains-arguments.js new file mode 100644 index 0000000000..037585ce47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-contains-arguments.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-arguments.case +// - src/class-elements/initializer-indirect-eval-arguments/cls-expr-fields-indirect-eval-nested.template +/*--- +description: No error if `arguments` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public] +flags: [generated, noStrict] +info: | + For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer" + (in #sec-performeval-rules-in-initializer) are NOT applicable. + +---*/ + + +var arguments = 1; +var C = class { + x = () => (0, eval)('arguments;'); +} + +assert.sameValue(new C().x(), arguments); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..4524e19275 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-indirect-eval-err-contains-newtarget.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-fields-indirect-eval-nested.template +/*--- +description: error if `new.target` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-public] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + x = (0, eval)('executed = true; new.target;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..9d414b0dcd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-literal-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..fffa55a81c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-literal-name-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-literal-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js new file mode 100644 index 0000000000..23bfd5f98e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-arrow-fnc-nested.template +/*--- +description: Syntax error if `arguments` used in class field (private field, arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = () => { + var t = () => arguments; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-super.js new file mode 100644 index 0000000000..0dbfb406f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-arrow-fnc-init-err-contains-super.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-arrow-fnc-nested.template +/*--- +description: Syntax error if `super()` used in class field (private field, arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = () => { + var t = () => super(); + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..4e3c7ce922 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-eval-nested.template +/*--- +description: super.x in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super.x;'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..dff21549ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-eval-nested.template +/*--- +description: super['x'] in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super["x"];'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..57a2e71c00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval-nested.template +/*--- +description: error if `super()['x']` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..c60224a41f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval-nested.template +/*--- +description: error if `super().x` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js new file mode 100644 index 0000000000..ef84050622 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval-nested.template +/*--- +description: error if `super()` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..ae93f31bff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-indirect-eval-nested.template +/*--- +description: super.x in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super.x;'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..5a2e6b1b91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-indirect-eval-nested.template +/*--- +description: super['x'] in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super["x"];'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..8060892c55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval-nested.template +/*--- +description: error if `super()['x']` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..1e2f465fd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval-nested.template +/*--- +description: error if `super().x` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js new file mode 100644 index 0000000000..aaed9d221b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval-nested.template +/*--- +description: error if `super()` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-arguments.js new file mode 100644 index 0000000000..47463f08ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-arguments.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-arguments.case +// - src/class-elements/initializer-direct-eval-arguments/cls-expr-private-fields-eval-nested.template +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + It is a Syntax Error if ContainsArguments of StatementList is true. + ... + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +var executed = false; +var C = class { + #x = () => eval('executed = true; arguments;'); + x() { + this.#x(); + } +} + +assert.throws(SyntaxError, function() { + new C().x(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..a42ea1e4ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-direct-eval-err-contains-newtarget.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-private-fields-eval-nested.template +/*--- +description: error if `new.target` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + #x = eval('executed = true; new.target;'); +} + +var c = new C(); + +assert.sameValue(executed, true); +assert.sameValue(c.x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-contains-arguments.js new file mode 100644 index 0000000000..ac8fc3ebbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-contains-arguments.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-arguments.case +// - src/class-elements/initializer-indirect-eval-arguments/cls-expr-private-fields-indirect-eval-nested.template +/*--- +description: No error if `arguments` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated, noStrict] +info: | + For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer" + (in #sec-performeval-rules-in-initializer) are NOT applicable. + +---*/ + + +var arguments = 1; +var C = class { + #x = () => (0, eval)('arguments;'); + x() { + return this.#x(); + } +} + +assert.sameValue(new C().x(), arguments); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..748c054d11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-err-contains-newtarget.js @@ -0,0 +1,38 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-private-fields-indirect-eval-nested.template +/*--- +description: error if `new.target` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + #x = (0, eval)('executed = true; new.target;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..6ee31b0cf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (ClassElementName PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + #x = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..118c28a2cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-literal-name-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (ClassElementName PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + #x = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-arguments.js new file mode 100644 index 0000000000..d6141ffba6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-ternary-nested.template +/*--- +description: Syntax error if `arguments` used in class field (private field, ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + #x = () => true ? {} : arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-super.js new file mode 100644 index 0000000000..4d636d35fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-ternary-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-ternary-nested.template +/*--- +description: Syntax error if `super()` used in class field (private field, ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + #x = () => true ? {} : super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-arguments.js new file mode 100644 index 0000000000..5a297a3a8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-typeof-nested.template +/*--- +description: Syntax error if `arguments` used in class field (private field, typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + #x = () => typeof arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-super.js new file mode 100644 index 0000000000..f5a9e9a22e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-typeof-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-typeof-nested.template +/*--- +description: Syntax error if `super()` used in class field (private field, typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + #x = () => typeof super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..2fb25520bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-comp-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (static computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public, computed-property-names] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + static [x] = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-super.js new file mode 100644 index 0000000000..9c155d9dd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-comp-name-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-comp-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (static computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public, computed-property-names] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + static [x] = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-arguments.js new file mode 100644 index 0000000000..bea5192253 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-literal-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (static literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + static x = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-super.js new file mode 100644 index 0000000000..28511188e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-literal-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-literal-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (static literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + static x = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-arguments.js new file mode 100644 index 0000000000..e32a5f8458 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-private-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (static PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + static #x = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-super.js new file mode 100644 index 0000000000..d507688db7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-private-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-private-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (static PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + static #x = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..48e23c129e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-string-literal-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (static string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + static 'x' = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..ec8c7419e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-string-literal-name-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-string-literal-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (static string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + static 'x' = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..ed95c89fc9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-string-literal-name-nested.template +/*--- +description: Syntax error if `arguments` used in class field (string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + 'x' = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..421942f700 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-string-literal-name-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-string-literal-name-nested.template +/*--- +description: Syntax error if `super()` used in class field (string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + 'x' = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-arguments.js new file mode 100644 index 0000000000..4f88d747d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-ternary-nested.template +/*--- +description: Syntax error if `arguments` used in class field (ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => true ? {} : arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-super.js new file mode 100644 index 0000000000..cf7764091f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-ternary-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-ternary-nested.template +/*--- +description: Syntax error if `super()` used in class field (ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => true ? {} : super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-arguments.js new file mode 100644 index 0000000000..3bc14c08c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-typeof-nested.template +/*--- +description: Syntax error if `arguments` used in class field (typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => typeof arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-super.js new file mode 100644 index 0000000000..fb8c7b25ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-typeof-init-err-contains-super.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-typeof-nested.template +/*--- +description: Syntax error if `super()` used in class field (typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + +$DONOTEVALUATE(); + +var C = class { + x = () => typeof super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-names.js new file mode 100644 index 0000000000..6cad26eb47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-names.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + [x] = 42; [10] = "meep"; ["not initialized"] + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-symbol-names.js new file mode 100644 index 0000000000..17cf76aa18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-symbol-names.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..466ee6b62a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J; + m() { return 42; } + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names-asi.js new file mode 100644 index 0000000000..445d636ffe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names-asi.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names.js new file mode 100644 index 0000000000..da472acc54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-field-usage.js new file mode 100644 index 0000000000..0d51862f47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-field-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = 'test262'; + m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-getter-usage.js new file mode 100644 index 0000000000..3d3e75b028 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-getter-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; } + m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-usage.js new file mode 100644 index 0000000000..f7ed26a7f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; } + m() { return 42; } + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-names.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-names.js new file mode 100644 index 0000000000..5c515c5a35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-names.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: private names (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + #x; #y + m() { return 42; } + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..f649aade42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1 + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier.js new file mode 100644 index 0000000000..a0ace6009d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter-alt.js new file mode 100644 index 0000000000..8133b18889 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter-alt.js @@ -0,0 +1,127 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter.js new file mode 100644 index 0000000000..804d12cefc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter.js @@ -0,0 +1,127 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method-alt.js new file mode 100644 index 0000000000..9212067075 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method.js new file mode 100644 index 0000000000..e9283f6fb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter-alt.js new file mode 100644 index 0000000000..f36c0d7605 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } + + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter.js new file mode 100644 index 0000000000..ce014f4dab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } + + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..a3ff4e1385 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..9ee10301dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1 + m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..3387865149 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1 + m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier.js new file mode 100644 index 0000000000..70b50f05b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..c9fdf6584a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + } + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..48530cf5d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + } + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..28b089b4b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + } + m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..04091168ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + } + m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..1bab20e9ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + } + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..ea966d1059 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,124 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + } + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..d3ed0e9d29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + } + m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..43b8e0fb41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + } + m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..f465e49a5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..d7dc95cd15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..db8df29ce9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..02a09fa8e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + m() { return 42; } + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..92810d6b2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..bf0daf7ef2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1 + m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..fced1bec17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-fields.js new file mode 100644 index 0000000000..05900a28dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-fields.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: static private fields (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x; static #y + m() { return 42; } + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..1a39c7ddc9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js @@ -0,0 +1,87 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal + m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods.js new file mode 100644 index 0000000000..a83fcd072f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods.js @@ -0,0 +1,74 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: static private methods (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + + m() { return 42; } + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-string-literal-names.js new file mode 100644 index 0000000000..b6d5a16544 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-string-literal-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: String literal names (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42 + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-names.js new file mode 100644 index 0000000000..2efd12c278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-names.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Computed property names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + [x] = 42; [10] = "meep"; ["not initialized"]; + *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000..4a01b8529a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-symbol-names.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; + *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..a95f2f8345 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + *m() { return 42; } + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names-asi.js new file mode 100644 index 0000000000..1ba86ae16e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names-asi.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42;; + *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names.js new file mode 100644 index 0000000000..5164f34574 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Literal property names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; + *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-field-usage.js new file mode 100644 index 0000000000..0d709bc157 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-field-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = 'test262';; + *m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-getter-usage.js new file mode 100644 index 0000000000..6d4e9f6c34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-getter-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; }; + *m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-usage.js new file mode 100644 index 0000000000..57c7286511 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; }; + *m() { return 42; } + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-names.js new file mode 100644 index 0000000000..5bd47bddc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-names.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: private names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + #x; #y; + *m() { return 42; } + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..3425f98da6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier.js new file mode 100644 index 0000000000..9ae0a5e813 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter-alt.js new file mode 100644 index 0000000000..0c40451b3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter-alt.js @@ -0,0 +1,127 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter.js new file mode 100644 index 0000000000..5a668feab4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter.js @@ -0,0 +1,127 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method-alt.js new file mode 100644 index 0000000000..588e4fa837 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method.js new file mode 100644 index 0000000000..d552988b66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter-alt.js new file mode 100644 index 0000000000..2ebf07acc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter.js new file mode 100644 index 0000000000..2632999ead --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..36190d3a4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..cefd3b90e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + *m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..49d9745d42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + *m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier.js new file mode 100644 index 0000000000..463c8c0dc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..2951c449ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..7258ebdeac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..af12038098 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + *m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..182d6cc5b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + *m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..9c23f7408e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..b206ea774d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,124 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..88639caf27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + *m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..5864947e99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + *m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..12a6d3982a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + *m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..4a7290b08e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + *m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..7c5f1ca360 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + *m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..06bdcfd2de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + *m() { return 42; } + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..7e50fd37d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + *m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..5bd31ddc07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + *m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..17a005ff13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + *m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-fields.js new file mode 100644 index 0000000000..0881e1093d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-fields.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: static private fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x; static #y; + *m() { return 42; } + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..17acc4833a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,87 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; + *m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods.js new file mode 100644 index 0000000000..67c8e257f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods.js @@ -0,0 +1,74 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: static private methods (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ; + *m() { return 42; } + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-string-literal-names.js new file mode 100644 index 0000000000..906f2e0cc5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-string-literal-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-generator.template +/*--- +description: String literal names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; + *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-names.js new file mode 100644 index 0000000000..84526f74f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-names.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + [x] = 42; [10] = "meep"; ["not initialized"]; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-symbol-names.js new file mode 100644 index 0000000000..162d14c105 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-symbol-names.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..6ab2fd98ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + m() { return 42; } + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names-asi.js new file mode 100644 index 0000000000..2404aac145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names-asi.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42;; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names.js new file mode 100644 index 0000000000..f19417115c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-field-usage.js new file mode 100644 index 0000000000..d7fd36e006 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-field-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = 'test262';; + m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-getter-usage.js new file mode 100644 index 0000000000..c39dd2054c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-getter-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; }; + m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-usage.js new file mode 100644 index 0000000000..eb203447a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-usage.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; }; + m() { return 42; } + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-names.js new file mode 100644 index 0000000000..61c390960b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-names.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: private names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + #x; #y; + m() { return 42; } + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..e6cf467178 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier.js new file mode 100644 index 0000000000..770fb02863 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter-alt.js new file mode 100644 index 0000000000..1586bb425d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter-alt.js @@ -0,0 +1,127 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter.js new file mode 100644 index 0000000000..6f57eeb8cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter.js @@ -0,0 +1,127 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method-alt.js new file mode 100644 index 0000000000..9099f6df2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method.js new file mode 100644 index 0000000000..f5716683df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter-alt.js new file mode 100644 index 0000000000..15ce238c07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter.js new file mode 100644 index 0000000000..c8ad4f68e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..6e58cf36aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..4e00eef939 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..6a2d9cfdf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier.js new file mode 100644 index 0000000000..c76a759b98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..507f60e9d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..036d468de6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..b734772b04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..a12470f05d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..fed1053c14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..1509cf92ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,124 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..8a0b709668 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..21d3bf1ef8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..0e7c1dbacb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..92675c396d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..d3a58bcb30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..fe953f72c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + m() { return 42; } + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..2ccc4c5212 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..cad3483b0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,103 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..ffe0f04e2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-fields.js new file mode 100644 index 0000000000..cc08ba6974 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-fields.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: static private fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x; static #y; + m() { return 42; } + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..e7c3a6ccc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods-with-fields.js @@ -0,0 +1,87 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; + m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods.js new file mode 100644 index 0000000000..683d6f4a0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods.js @@ -0,0 +1,74 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: static private methods (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ; + m() { return 42; } + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-string-literal-names.js new file mode 100644 index 0000000000..6a231e2f28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-string-literal-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-new-sc-line-method.template +/*--- +description: String literal names (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; + m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/browser.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js new file mode 100644 index 0000000000..df149e9fa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-ZWJ.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - ZWJ (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #ZW_\u200D_J() { return 'get string'; } + set #ZW_\u200D_J(param) { stringSet = param; } + + getPrivateReference() { + return this.#ZW_‍_J; + } + + setPrivateReference(value) { + this.#ZW_‍_J = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js new file mode 100644 index 0000000000..5c9a174396 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-ZWNJ.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - ZWNJ (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #ZW_\u200C_NJ() { return 'get string'; } + set #ZW_\u200C_NJ(param) { stringSet = param; } + + getPrivateReference() { + return this.#ZW_‌_NJ; + } + + setPrivateReference(value) { + this.#ZW_‌_NJ = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js new file mode 100644 index 0000000000..aa6dc3bd88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-u2118.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - u2118 (℘) (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #\u2118() { return 'get string'; } + set #\u2118(param) { stringSet = param; } + + getPrivateReference() { + return this.#℘; + } + + setPrivateReference(value) { + this.#℘ = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js new file mode 100644 index 0000000000..0a32ccecf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-u6F.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - u6F (o) (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #\u{6F}() { return 'get string'; } + set #\u{6F}(param) { stringSet = param; } + + getPrivateReference() { + return this.#o; + } + + setPrivateReference(value) { + this.#o = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWJ.js new file mode 100644 index 0000000000..3d7703c721 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-ZWJ.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - ZWJ (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #ZW_‍_J() { return 'get string'; } + set #ZW_‍_J(param) { stringSet = param; } + + getPrivateReference() { + return this.#ZW_‍_J; + } + + setPrivateReference(value) { + this.#ZW_‍_J = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWNJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWNJ.js new file mode 100644 index 0000000000..ba7811d80b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWNJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-ZWNJ.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - ZWNJ (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #ZW_‌_NJ() { return 'get string'; } + set #ZW_‌_NJ(param) { stringSet = param; } + + getPrivateReference() { + return this.#ZW_‌_NJ; + } + + setPrivateReference(value) { + this.#ZW_‌_NJ = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-common.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-common.js new file mode 100644 index 0000000000..a79ce7e97e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-common.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-common.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - common (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #test262() { return 'get string'; } + set #test262(param) { stringSet = param; } + + getPrivateReference() { + return this.#test262; + } + + setPrivateReference(value) { + this.#test262 = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-dollar.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-dollar.js new file mode 100644 index 0000000000..9e209979f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-dollar.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-dollar.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - $ (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #$() { return 'get string'; } + set #$(param) { stringSet = param; } + + getPrivateReference() { + return this.#$; + } + + setPrivateReference(value) { + this.#$ = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-u2118.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-u2118.js new file mode 100644 index 0000000000..131e969acd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-u2118.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-u2118.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - ℘ (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #℘() { return 'get string'; } + set #℘(param) { stringSet = param; } + + getPrivateReference() { + return this.#℘; + } + + setPrivateReference(value) { + this.#℘ = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-underscore.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-underscore.js new file mode 100644 index 0000000000..ebcbdc8d07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-underscore.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-underscore.case +// - src/accessor-names/private/cls-private-expr-inst.template +/*--- +description: Private IdentifierName - _ (Class expression, instance private method) +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + get #_() { return 'get string'; } + set #_(param) { stringSet = param; } + + getPrivateReference() { + return this.#_; + } + + setPrivateReference(value) { + this.#_ = value; + } +}; + +var inst = new C(); + +assert.sameValue(inst.getPrivateReference(), 'get string'); + +inst.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/shell.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js new file mode 100644 index 0000000000..ed17b0ceed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-ZWJ.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - ZWJ (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #ZW_\u200D_J() { return 'get string'; } + static set #ZW_\u200D_J(param) { stringSet = param; } + + static getPrivateReference() { + return this.#ZW_‍_J; + } + + static setPrivateReference(value) { + this.#ZW_‍_J = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js new file mode 100644 index 0000000000..00a577491c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-ZWNJ.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - ZWNJ (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #ZW_\u200C_NJ() { return 'get string'; } + static set #ZW_\u200C_NJ(param) { stringSet = param; } + + static getPrivateReference() { + return this.#ZW_‌_NJ; + } + + static setPrivateReference(value) { + this.#ZW_‌_NJ = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js new file mode 100644 index 0000000000..b02b0aa5df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-u2118.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - u2118 (℘) (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #\u2118() { return 'get string'; } + static set #\u2118(param) { stringSet = param; } + + static getPrivateReference() { + return this.#℘; + } + + static setPrivateReference(value) { + this.#℘ = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js new file mode 100644 index 0000000000..dec138477b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-escape-sequence-u6F.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - u6F (o) (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #\u{6F}() { return 'get string'; } + static set #\u{6F}(param) { stringSet = param; } + + static getPrivateReference() { + return this.#o; + } + + static setPrivateReference(value) { + this.#o = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWJ.js new file mode 100644 index 0000000000..a4b4933c43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-ZWJ.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - ZWJ (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #ZW_‍_J() { return 'get string'; } + static set #ZW_‍_J(param) { stringSet = param; } + + static getPrivateReference() { + return this.#ZW_‍_J; + } + + static setPrivateReference(value) { + this.#ZW_‍_J = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWNJ.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWNJ.js new file mode 100644 index 0000000000..a0cca12394 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWNJ.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-ZWNJ.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - ZWNJ (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #ZW_‌_NJ() { return 'get string'; } + static set #ZW_‌_NJ(param) { stringSet = param; } + + static getPrivateReference() { + return this.#ZW_‌_NJ; + } + + static setPrivateReference(value) { + this.#ZW_‌_NJ = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-common.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-common.js new file mode 100644 index 0000000000..2c99b82c9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-common.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-common.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - common (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #test262() { return 'get string'; } + static set #test262(param) { stringSet = param; } + + static getPrivateReference() { + return this.#test262; + } + + static setPrivateReference(value) { + this.#test262 = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-dollar.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-dollar.js new file mode 100644 index 0000000000..15854a83ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-dollar.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-dollar.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - $ (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #$() { return 'get string'; } + static set #$(param) { stringSet = param; } + + static getPrivateReference() { + return this.#$; + } + + static setPrivateReference(value) { + this.#$ = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-u2118.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-u2118.js new file mode 100644 index 0000000000..442723aefc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-u2118.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-u2118.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - ℘ (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #℘() { return 'get string'; } + static set #℘(param) { stringSet = param; } + + static getPrivateReference() { + return this.#℘; + } + + static setPrivateReference(value) { + this.#℘ = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-underscore.js b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-underscore.js new file mode 100644 index 0000000000..23aa11a011 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-underscore.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/accessor-names/private-name-underscore.case +// - src/accessor-names/private/cls-private-expr-static.template +/*--- +description: Private IdentifierName - _ (Class expression, static private method) +features: [class, class-static-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + +var stringSet; + +var C = class { + static get #_() { return 'get string'; } + static set #_(param) { stringSet = param; } + + static getPrivateReference() { + return this.#_; + } + + static setPrivateReference(value) { + this.#_ = value; + } +}; + + +assert.sameValue(C.getPrivateReference(), 'get string'); + +C.setPrivateReference('set string'); +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-arguments.js new file mode 100644 index 0000000000..f8219b5add --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-arrow-fnc.template +/*--- +description: Syntax error if `arguments` used in class field (private field, arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = () => arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-super.js new file mode 100644 index 0000000000..c216c3d791 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-arrow-fnc-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-arrow-fnc.template +/*--- +description: Syntax error if `super()` used in class field (private field, arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = () => super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/private-async-generator-method-name.js b/js/src/tests/test262/language/expressions/class/elements/private-async-generator-method-name.js new file mode 100644 index 0000000000..2557485c66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-async-generator-method-name.js @@ -0,0 +1,62 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-async-generator-method-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private async generators methods have name property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + AsyncMethod : async [no LineTerminator here] * ClassElementName (UniqueFormalParameters) { AsyncFunctionBody } + 1. Let propKey be the result of evaluating ClassElementName. + ... + 12. Perform ? DefineOrdinaryMethod(key, homeObject, closure, enumerable). + + ClassElementName : PrivateIdentifier + 1. Let bindingName be StringValue of PrivateIdentifier. + ... + 5. If scopeEnvRec's binding for bindingName is uninitialized, + a. Let field be NewPrivateName(bindingName). + b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field). + 6. Otherwise, + a. Let field be scopeEnvRec.GetBindingValue(bindingName). + 7. Assert: field.[[Description]] is bindingName. + 8. Return field. + + DefineOrdinaryMethod(key, homeObject, closure, enumerable) + 1. Perform SetFunctionName(closure, key). + 2. If key is a Private Name, + a. Assert: key does not have a [[Kind]] field. + b. Set key.[[Kind]] to "method". + c. Set key.[[Value]] to closure. + d. Set key.[[Brand]] to homeObject. + 3. Else, + a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). + +---*/ + + +var C = class { + async * #method() {}; + + getPrivateMethod() { + return this.#method; + } +} + +let c = new C(); +assert.sameValue(c.getPrivateMethod().name, "#method"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-async-method-name.js b/js/src/tests/test262/language/expressions/class/elements/private-async-method-name.js new file mode 100644 index 0000000000..ecbde9f434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-async-method-name.js @@ -0,0 +1,62 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-async-method-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private async methods have name property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + AsyncMethod : async [no LineTerminator here] ClassElementName (UniqueFormalParameters) { AsyncFunctionBody } + 1. Let propKey be the result of evaluating ClassElementName. + ... + 10. Perform ? DefineOrdinaryMethod(key, homeObject, closure, enumerable). + + ClassElementName : PrivateIdentifier + 1. Let bindingName be StringValue of PrivateIdentifier. + ... + 5. If scopeEnvRec's binding for bindingName is uninitialized, + a. Let field be NewPrivateName(bindingName). + b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field). + 6. Otherwise, + a. Let field be scopeEnvRec.GetBindingValue(bindingName). + 7. Assert: field.[[Description]] is bindingName. + 8. Return field. + + DefineOrdinaryMethod(key, homeObject, closure, enumerable) + 1. Perform SetFunctionName(closure, key). + 2. If key is a Private Name, + a. Assert: key does not have a [[Kind]] field. + b. Set key.[[Kind]] to "method". + c. Set key.[[Value]] to closure. + d. Set key.[[Brand]] to homeObject. + 3. Else, + a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). + +---*/ + + +var C = class { + async #method() {}; + + getPrivateMethod() { + return this.#method; + } +} + +let c = new C(); +assert.sameValue(c.getPrivateMethod().name, "#method"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..053373c6f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-eval.template +/*--- +description: super.x in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super.x;'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..310515be01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-eval.template +/*--- +description: super['x'] in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super["x"];'); +}; + +new C(); + +assert.sameValue(executed, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..baff247702 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval.template +/*--- +description: error if `super()['x']` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..1fd012c766 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval.template +/*--- +description: error if `super().x` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js new file mode 100644 index 0000000000..f66083c59a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-eval.template +/*--- +description: error if `super()` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = eval('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js new file mode 100644 index 0000000000..0e60d46bb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-1.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-indirect-eval.template +/*--- +description: super.x in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super.x;'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js new file mode 100644 index 0000000000..fb9d518e6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-superproperty-2.case +// - src/class-elements/initializer-eval-super-property/cls-expr-private-fields-indirect-eval.template +/*--- +description: super['x'] in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Methods + + These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition. + + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperProperty. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super["x"];'); +}; + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js new file mode 100644 index 0000000000..84d7d5fe97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-1.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval.template +/*--- +description: error if `super()['x']` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super()["x"];'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js new file mode 100644 index 0000000000..e251654841 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall-2.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval.template +/*--- +description: error if `super().x` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super().x;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js new file mode 100644 index 0000000000..5b4a33067a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-supercall.case +// - src/class-elements/initializer-eval-super-call/cls-expr-private-fields-indirect-eval.template +/*--- +description: error if `super()` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Constructor Methods + These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains SuperCall. + +---*/ + + +var executed = false; +var A = class {} +var C = class extends A { + #x = (0, eval)('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-arguments.js new file mode 100644 index 0000000000..d9579ffcf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-arguments.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-arguments.case +// - src/class-elements/initializer-direct-eval-arguments/cls-expr-private-fields-eval.template +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + It is a Syntax Error if ContainsArguments of StatementList is true. + ... + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +var executed = false; +var C = class { + #x = eval('executed = true; arguments;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..90e31637b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-direct-eval-err-contains-newtarget.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-private-fields-eval.template +/*--- +description: error if `new.target` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + #x = eval('executed = true; new.target;'); +} + +var c = new C(); + +assert.sameValue(executed, true); +assert.sameValue(c.x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-arrow-function.js new file mode 100644 index 0000000000..f73851923c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-arrow-function.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-access-on-inner-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private field is visible on inner arrow function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #f = 'Test262'; + + method() { + let arrowFunction = () => { + return this.#f; + } + + return arrowFunction(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private field from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-function.js b/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-function.js new file mode 100644 index 0000000000..3567256e4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-function.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-access-on-inner-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private field is visible on inner function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #f = 'Test262'; + + method() { + let self = this; + function innerFunction() { + return self.#f; + } + + return innerFunction(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private field from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-after-optional-chain.js b/js/src/tests/test262/language/expressions/class/elements/private-field-after-optional-chain.js new file mode 100644 index 0000000000..c241f67ca6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-after-optional-chain.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-after-optional-chain.case +// - src/class-elements/default/cls-expr.template +/*--- +description: OptionalChain.PrivateIdentifier is a valid syntax (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, optional-chaining, class] +flags: [generated] +info: | + Updated Productions + + OptionalChain[Yield, Await] : + `?.` `[` Expression[+In, ?Yield, ?Await] `]` + `?.` IdentifierName + `?.` Arguments[?Yield, ?Await] + `?.` TemplateLiteral[?Yield, ?Await, +Tagged] + OptionalChain[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]` + OptionalChain[?Yield, ?Await] `.` IdentifierName + OptionalChain[?Yield, ?Await] Arguments[?Yield, ?Await] + OptionalChain[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] + OptionalChain[?Yield, ?Await] `.` PrivateIdentifier + +---*/ + + +var C = class { + #f = 'Test262'; + + method(o) { + return o?.c.#f; + } +} + +let c = new C(); +let o = {c: c}; +assert.sameValue(c.method(o), 'Test262'); + +assert.sameValue(c.method(null), undefined); +assert.sameValue(c.method(undefined), undefined); + +o = {c: new Object()}; +assert.throws(TypeError, function() { + c.method(o); +}, 'accessed private field from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-as-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/private-field-as-arrow-function.js new file mode 100644 index 0000000000..0e1e1163c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-arrow-function.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-as-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Calling arrow function returned from private field access (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, arrow-function, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = () => 'test262'; + + method() { + return this.#m(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-arrow-function.js new file mode 100644 index 0000000000..e6ae363940 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-arrow-function.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-as-async-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Calling async arrow function returned from private field access (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, async-functions, arrow-function, class] +flags: [generated, async] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = async () => 'test262'; + + method() { + return this.#m(); + } +} + +let c = new C(); + +c.method().then((value) => assert.sameValue(value, 'test262')) + .then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-function.js b/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-function.js new file mode 100644 index 0000000000..b87a3f24c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-function.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-as-async-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Calling async function returned from private field access (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, async-functions, class] +flags: [generated, async] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = async function() { return 'test262'; }; + + method() { + return this.#m(); + } +} + +let c = new C(); + +c.method().then((value) => assert.sameValue(value, 'test262')) + .then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-as-function.js b/js/src/tests/test262/language/expressions/class/elements/private-field-as-function.js new file mode 100644 index 0000000000..7f0626f73c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-function.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-as-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Calling result returned from private field access (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = function () { return 'test262'; }; + + method() { + return this.#m(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-field-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-field-on-nested-class.js new file mode 100644 index 0000000000..b7934576ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-on-nested-class.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #outer = 'test262'; + + B_withoutPrivateField = class { + method(o) { + return o.#outer; + } + } + + B_withPrivateField = class { + #inner = 42; + method(o) { + return o.#outer; + } + } +} + +let c = new C(); +let innerB1 = new c.B_withoutPrivateField(); +assert.sameValue(innerB1.method(c), 'test262'); +let innerB2 = new c.B_withPrivateField(); +assert.sameValue(innerB2.method(c), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-fields-proxy-default-handler-throws.js b/js/src/tests/test262/language/expressions/class/elements/private-fields-proxy-default-handler-throws.js new file mode 100644 index 0000000000..65e95dba91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-fields-proxy-default-handler-throws.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-privatefieldget +description: Private fields not accessible via default Proxy handler +info: | + 1. Assert: P is a Private Name value. + 2. If O is not an object, throw a TypeError exception. + 3. Let entry be PrivateFieldFind(P, O). + 4. If entry is empty, throw a TypeError exception. + +features: [class, class-fields-private] +---*/ + + +var C = class { + #x = 1; + x() { + return this.#x; + } +} + +var c = new C(); +var p = new Proxy(c, {}); + +assert.sameValue(c.x(), 1); +assert.throws(TypeError, function() { + p.x(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-generator-method-name.js b/js/src/tests/test262/language/expressions/class/elements/private-generator-method-name.js new file mode 100644 index 0000000000..173c2e2e86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-generator-method-name.js @@ -0,0 +1,62 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-generator-method-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private generator methods have name property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + GeneratorMethod : * ClassElementName (UniqueFormalParameters) { GeneratorBody } + 1. Let key be the result of evaluating ClassElementName. + ... + 12. Return DefineOrdinaryMethod(key, homeObject, closure, enumerable). + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + ClassElementName : PrivateIdentifier + 1. Let bindingName be StringValue of PrivateIdentifier. + ... + 5. If scopeEnvRec's binding for bindingName is uninitialized, + a. Let field be NewPrivateName(bindingName). + b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field). + 6. Otherwise, + a. Let field be scopeEnvRec.GetBindingValue(bindingName). + 7. Assert: field.[[Description]] is bindingName. + 8. Return field. + + DefineOrdinaryMethod(key, homeObject, closure, enumerable) + 1. Perform SetFunctionName(closure, key). + 2. If key is a Private Name, + a. Assert: key does not have a [[Kind]] field. + b. Set key.[[Kind]] to "method". + c. Set key.[[Value]] to closure. + d. Set key.[[Brand]] to homeObject. + 3. Else, + a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). + +---*/ + + +var C = class { + * #method() {}; + + getPrivateMethod() { + return this.#method; + } +} + +let c = new C(); +assert.sameValue(c.getPrivateMethod().name, "#method"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-arrow-function.js new file mode 100644 index 0000000000..a7bca86e4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-arrow-function.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-access-on-inner-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private getter is visible on inner arrow function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'Test262'; } + + method() { + let arrowFunction = () => { + return this.#m; + } + + return arrowFunction(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private accessor from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-function.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-function.js new file mode 100644 index 0000000000..2c61874342 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-function.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-access-on-inner-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private getter is visible on inner function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'Test262'; } + + method() { + let self = this; + function innerFunction() { + return self.#m; + } + + return innerFunction(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private accessor from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-is-not-a-own-property.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-is-not-a-own-property.js new file mode 100644 index 0000000000..b251fad8a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-is-not-a-own-property.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-is-not-a-own-property.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private getter is not stored as an own property of objects (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + a. Let entry be PrivateFieldFind(P, O). + b. If entry is empty, throw a TypeError exception. + c. Return entry.[[PrivateFieldValue]]. + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + 6. Else, + a. Assert: P.[[Kind]] is "accessor". + b. If P does not have a [[Get]] field, throw a TypeError exception. + c. Let getter be P.[[Get]]. + d. Return ? Call(getter, O). + +---*/ + + +var C = class { + get #m() { return "Test262"; } + + checkPrivateGetter() { + assert.sameValue(this.hasOwnProperty("#m"), false); + assert.sameValue("#m" in this, false); + + assert.sameValue(this.__lookupGetter__("#m"), undefined); + + assert.sameValue(this.#m, "Test262"); + + return 0; + } +} + +let c = new C(); +assert.sameValue(c.checkPrivateGetter(), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-on-nested-class.js new file mode 100644 index 0000000000..579dcd372f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-on-nested-class.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private getter is available on inner classes (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; } + + B = class { + method(o) { + return o.#m; + } + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(c), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-field-on-nested-class.js new file mode 100644 index 0000000000..1b283a1a88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-field-on-nested-class.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-shadowed-by-field-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private getter can be shadowed on inner classes by a private field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'outer class'; } + + method() { return this.#m; } + + B = class { + method(o) { + return o.#m; + } + + #m = 'test262'; + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(innerB), 'test262'); +assert.sameValue(c.method(), 'outer class'); +assert.throws(TypeError, function() { + innerB.method(c); +}, 'accessed inner class field from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-getter-on-nested-class.js new file mode 100644 index 0000000000..6e34cc2356 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-shadowed-by-getter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private getter can be shadowed on inner classes by a private getter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'outer class'; } + + method() { return this.#m; } + + B = class { + method(o) { + return o.#m; + } + + get #m() { return 'test262'; } + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(innerB), 'test262'); +assert.sameValue(c.method(), 'outer class'); +assert.throws(TypeError, function() { + innerB.method(c); +}, 'accessed inner class getter from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-method-on-nested-class.js new file mode 100644 index 0000000000..49d416f99d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-method-on-nested-class.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-shadowed-by-method-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private getter can be shadowed on inner class by a private method (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { throw new Test262Error(); } + + B = class { + method(o) { + return o.#m(); + } + + #m() { return 'test262'; } + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(innerB), 'test262'); +assert.throws(TypeError, function() { + innerB.method(c); +}, 'accessed inner class method from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-setter-on-nested-class.js new file mode 100644 index 0000000000..9a53b043fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,52 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-getter-shadowed-by-setter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private getter can be shadowed on inner classes by a private setter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'outer class'; } + + method() { return this.#m; } + + B = class { + method(o) { + return o.#m; + } + + set #m(v) { this._v = v; } + } +} + +let c = new C(); +let innerB = new c.B(); + +assert.throws(TypeError, function() { + innerB.method(innerB); +}, '[[Get]] operation of an accessor without getter'); + +assert.sameValue(c.method(), 'outer class'); + +assert.throws(TypeError, function() { + innerB.method(c); +}, 'access of inner class accessor from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-contains-arguments.js new file mode 100644 index 0000000000..8a3a312976 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-contains-arguments.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-contains-arguments.case +// - src/class-elements/initializer-indirect-eval-arguments/cls-expr-private-fields-indirect-eval.template +/*--- +description: No error if `arguments` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, class-fields-private] +flags: [generated, noStrict] +info: | + For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer" + (in #sec-performeval-rules-in-initializer) are NOT applicable. + +---*/ + + +var arguments = 1; +var C = class { + #x = (0, eval)('arguments;'); + x() { + return this.#x; + } +} + +assert.sameValue(new C().x(), arguments); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-err-contains-newtarget.js new file mode 100644 index 0000000000..22f261200c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-err-contains-newtarget.js @@ -0,0 +1,38 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/eval-err-contains-newtarget.case +// - src/class-elements/initializer-eval-newtarget/cls-expr-private-fields-indirect-eval.template +/*--- +description: error if `new.target` in StatementList of eval (indirect eval) +esid: sec-performeval-rules-in-initializer +features: [class, new.target, class-fields-private] +flags: [generated] +info: | + Additional Early Error Rules for Eval Inside Initializer + These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. + ScriptBody : StatementList + + ... + The remaining eval rules apply as outside a constructor, inside a method, and inside a function. + + Additional Early Error Rules for Eval Outside Functions + These static semantics are applied by PerformEval when a direct eval call occurs outside of any function. + ScriptBody : StatementList + + It is a Syntax Error if StatementList Contains NewTarget. + +---*/ + + +var executed = false; +var C = class { + #x = (0, eval)('executed = true; new.target;'); +} + +assert.throws(SyntaxError, function() { + new C(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..1b0fb2e8aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-name.template +/*--- +description: Syntax error if `arguments` used in class field (ClassElementName PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..1fb07ce101 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-literal-name-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-name.template +/*--- +description: Syntax error if `super()` used in class field (ClassElementName PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-arrow-function.js new file mode 100644 index 0000000000..d5db684195 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-arrow-function.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-access-on-inner-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private method is visible on inner arrow function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'Test262'; } + + method() { + let arrowFunction = () => { + return this.#m(); + } + + return arrowFunction(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private method from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-function.js b/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-function.js new file mode 100644 index 0000000000..c5a62b747a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-function.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-access-on-inner-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private method is visible on inner function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'Test262'; } + + method() { + let self = this; + function innerFunction() { + return self.#m(); + } + + return innerFunction(); + } +} + +let c = new C(); +assert.sameValue(c.method(), 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private method from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-comparison.js b/js/src/tests/test262/language/expressions/class/elements/private-method-comparison.js new file mode 100644 index 0000000000..6412f89907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-comparison.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-comparison.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateFieldGet of a private method returns the same function object to every instance of the same class (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class, class-methods-private] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + a. Let entry be PrivateFieldFind(P, O). + b. If entry is empty, throw a TypeError exception. + c. Return entry.[[PrivateFieldValue]]. + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + 6. Else, + a. Assert: P.[[Kind]] is "accessor". + b. If P does not have a [[Get]] field, throw a TypeError exception. + c. Let getter be P.[[Get]]. + d. Return ? Call(getter, O). + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + #m() { return 'test262'; } + + getPrivateMethod() { + return this.#m; + } + +} + +let c1 = new C(); +let c2 = new C(); + +assert.sameValue(c1.getPrivateMethod(), c2.getPrivateMethod()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-get-and-call.js b/js/src/tests/test262/language/expressions/class/elements/private-method-get-and-call.js new file mode 100644 index 0000000000..2f5dad61e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-get-and-call.js @@ -0,0 +1,50 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-get-and-call.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Function returned by a private method can be called with other values as 'this' (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class, class-methods-private] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + a. Let entry be PrivateFieldFind(P, O). + b. If entry is empty, throw a TypeError exception. + c. Return entry.[[PrivateFieldValue]]. + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + 6. Else, + a. Assert: P.[[Kind]] is "accessor". + b. If P does not have a [[Get]] field, throw a TypeError exception. + c. Let getter be P.[[Get]]. + d. Return ? Call(getter, O). + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + #m() { return this._v; } + + getPrivateMethod() { + return this.#m; + } + +} + +let c = new C(); + +let o1 = {_v: 'test262'}; +let o2 = {_v: 'foo'}; +assert.sameValue(c.getPrivateMethod().call(o1), 'test262'); +assert.sameValue(c.getPrivateMethod().call(o2), 'foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-is-not-a-own-property.js b/js/src/tests/test262/language/expressions/class/elements/private-method-is-not-a-own-property.js new file mode 100644 index 0000000000..1c5b5a0f0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-is-not-a-own-property.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-is-not-a-own-property.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private method is not stored as an own property of objects (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + a. Let entry be PrivateFieldFind(P, O). + b. If entry is empty, throw a TypeError exception. + c. Return entry.[[PrivateFieldValue]]. + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + 6. Else, + a. Assert: P.[[Kind]] is "accessor". + b. If P does not have a [[Get]] field, throw a TypeError exception. + c. Let getter be P.[[Get]]. + d. Return ? Call(getter, O). + +---*/ + + +var C = class { + #m() { return "Test262"; } + + checkPrivateMethod() { + assert.sameValue(this.hasOwnProperty("#m"), false); + assert.sameValue("#m" in this, false); + + assert.sameValue(this.#m(), "Test262"); + + return 0; + } +} + +let c = new C(); +assert.sameValue(c.checkPrivateMethod(), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-length.js b/js/src/tests/test262/language/expressions/class/elements/private-method-length.js new file mode 100644 index 0000000000..fba80bb7ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-length.js @@ -0,0 +1,50 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-length.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private methods have length property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : static MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static". + + MethodDefinition : ClassElementName( UniqueFormalParameters ) { FunctionBody } + 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + 2. ReturnIfAbrupt(methodDef). + 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable). + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + MethodDefinition : ClassElementName (UniqueFormalParameters) { FunctionBody } + ... + 8. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, privateScope, strict, prototype). + 9. Perform MakeMethod(closure, object). + 10. Return the Record{[[Key]]: propKey, [[Closure]]: closure}. + +---*/ + + +var C = class { + #method(a) {}; + + getPrivateMethod() { + return this.#method; + } + +} + +let c = new C(); +assert.sameValue(c.getPrivateMethod().length, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-method-on-nested-class.js new file mode 100644 index 0000000000..38aa3df88f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-on-nested-class.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private method is available on inner classes (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; } + + B = class { + method(o) { + return o.#m(); + } + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(c), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-referenced-from-static-method.js b/js/src/tests/test262/language/expressions/class/elements/private-method-referenced-from-static-method.js new file mode 100644 index 0000000000..9added4d13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-referenced-from-static-method.js @@ -0,0 +1,41 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-referenced-from-static-method.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private method referenced from a static method (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + #f() { return 42; } + static g() { + return this.#f(); + } + +} + +assert.sameValue(C.g.call(new C()), 42); +assert.throws(TypeError, function() { + C.g(); +}, 'Accessed private method from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-field-on-nested-class.js new file mode 100644 index 0000000000..d60a3ba4cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-field-on-nested-class.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-shadowed-by-field-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private method can be shadowed on inner classes by a private field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'outer class'; } + + method() { return this.#m(); } + + B = class { + method(o) { + return o.#m; + } + + #m = 'test262'; + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(innerB), 'test262'); +assert.sameValue(c.method(), 'outer class'); +assert.throws(TypeError, function() { + innerB.method(c); +}, 'accessed inner class field from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-getter-on-nested-class.js new file mode 100644 index 0000000000..0e1d95346b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,50 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-shadowed-by-getter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private method can be shadowed on inner classes by a private getter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'outer class'; } + + method() { return this.#m(); } + + B = class { + method(o) { + return o.#m; + } + + get #m() { return 'test262'; } + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(innerB), 'test262'); +assert.sameValue(c.method(), 'outer class'); +assert.throws(TypeError, function() { + innerB.method(c); +}, 'accessed inner class getter from an object of outer class'); +assert.throws(TypeError, function() { + C.prototype.method.call(innerB); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-setter-on-nested-class.js new file mode 100644 index 0000000000..21c15e879b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,52 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-shadowed-by-setter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private method can be shadowed on inner classes by a private setter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'outer class'; } + + method() { return this.#m(); } + + B = class { + method(o) { + return o.#m; + } + + set #m(v) { this._v = v; } + } +} + +let c = new C(); +let innerB = new c.B(); + +assert.throws(TypeError, function() { + innerB.method(innerB); +}, '[[Get]] operation of an accessor without getter'); + +assert.sameValue(c.method(), 'outer class'); + +assert.throws(TypeError, function() { + innerB.method(c); +}, 'access of inner class accessor from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-on-nested-class.js new file mode 100644 index 0000000000..162b8835f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-on-nested-class.js @@ -0,0 +1,41 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-shadowed-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private method can be shadowed by inner class private method (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { throw new Test262Error(); } + + B = class { + method() { + return this.#m(); + } + + #m() { return 'test262'; } + } +} + +let c = new C(); +let innerB = new c.B(); +assert.sameValue(innerB.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-methods/browser.js b/js/src/tests/test262/language/expressions/class/elements/private-methods/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-generator.js b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-generator.js new file mode 100644 index 0000000000..48251449a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-generator.js @@ -0,0 +1,135 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-async-generator.case +// - src/class-elements/private-methods/cls-expr.template +/*--- +description: Private Async Generator (private method definitions in a class expression) +esid: prod-MethodDefinition +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + ... + ; + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + GeneratorMethod + AsyncMethod + AsyncGeneratorMethod + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){GeneratorBody} + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody } + + AsyncGeneratorMethod : + async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + --- + + InitializeClassElements ( F, proto ) + + ... + 5. For each item element in order from elements, + a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name. + b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype", + i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto. + ii. Perform ? DefineClassElement(receiver, element). + + InitializeInstanceElements ( O, constructor ) + + ... + 3. Let elements be the value of F's [[Elements]] internal slot. + 4. For each item element in order from elements, + a. If element.[[Placement]] is "own" and element.[[Kind]] is "method", + i. Perform ? DefineClassElement(O, element). + + DefineClassElement (receiver, element) + + ... + 6. If key is a Private Name, + a. Perform ? PrivateFieldDefine(receiver, key, descriptor). + + PrivateFieldDefine (P, O, desc) + + ... + 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]]. + +---*/ +var ctorPromise; + + + +/*** + * template notes: + * 1. method should always be #m + * 2. the template provides c.ref/other.ref for external reference + */ + +function hasProp(obj, name, expected, msg) { + var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name); + assert.sameValue(hasOwnProperty, expected, msg); + + var hasProperty = Reflect.has(obj, name); + assert.sameValue(hasProperty, expected, msg); +} + +var C = class { + async * #m() { return 42; } + + + get ref() { return this.#m; } + + constructor() { + hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties'); + assert.sameValue(typeof this.#m, 'function'); + assert.sameValue(this.ref, this.#m, 'returns the same value'); + assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms'); + + var ctorIter = this.#m(); + var p = ctorIter.next(); + ctorPromise = p.then(({ value, done }) => { + assert.sameValue(value, 42, 'return from generator method, inside ctor'); + assert.sameValue(done, true, 'iterator is done, inside ctor'); + }, $DONE); + assert.sameValue(this.#m.name, '#m', 'function name inside constructor'); + + } +} + +var c = new C(); +var other = new C(); + +hasProp(C.prototype, '#m', false, 'method is not defined in the prototype'); +hasProp(C, '#m', false, 'method is not defined in the contructor'); +hasProp(c, '#m', false, 'method cannot be seen outside of the class'); + +/*** + * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } + * + * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + * ... + */ +assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance'); + +assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference'); +ctorPromise.then(() => { + // gets the returned async iterator from #m + var iter = c.ref(); + return iter.next().then(({ value, done }) => { + assert.sameValue(value, 42, 'return from generator method'); + assert.sameValue(done, true, 'iterator is done'); + }); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-method.js b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-method.js new file mode 100644 index 0000000000..82f2deb232 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-method.js @@ -0,0 +1,130 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-async-method.case +// - src/class-elements/private-methods/cls-expr.template +/*--- +description: Private Async Method (private method definitions in a class expression) +esid: prod-MethodDefinition +features: [async-functions, class, class-methods-private] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + ... + ; + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + GeneratorMethod + AsyncMethod + AsyncGeneratorMethod + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){GeneratorBody} + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody } + + AsyncGeneratorMethod : + async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + --- + + InitializeClassElements ( F, proto ) + + ... + 5. For each item element in order from elements, + a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name. + b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype", + i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto. + ii. Perform ? DefineClassElement(receiver, element). + + InitializeInstanceElements ( O, constructor ) + + ... + 3. Let elements be the value of F's [[Elements]] internal slot. + 4. For each item element in order from elements, + a. If element.[[Placement]] is "own" and element.[[Kind]] is "method", + i. Perform ? DefineClassElement(O, element). + + DefineClassElement (receiver, element) + + ... + 6. If key is a Private Name, + a. Perform ? PrivateFieldDefine(receiver, key, descriptor). + + PrivateFieldDefine (P, O, desc) + + ... + 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]]. + +---*/ +var ctorPromise; + + + +/*** + * template notes: + * 1. method should always be #m + * 2. the template provides c.ref/other.ref for external reference + */ + +function hasProp(obj, name, expected, msg) { + var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name); + assert.sameValue(hasOwnProperty, expected, msg); + + var hasProperty = Reflect.has(obj, name); + assert.sameValue(hasProperty, expected, msg); +} + +var C = class { + async #m() { return 42; } + + + get ref() { return this.#m; } + + constructor() { + hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties'); + assert.sameValue(typeof this.#m, 'function'); + assert.sameValue(this.ref, this.#m, 'returns the same value'); + assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms'); + + assert.sameValue(this.#m.name, '#m', 'function name inside constructor'); + ctorPromise = this.#m().then(value => { + assert.sameValue(value, 42, 'already defined in the ctor'); + }, $DONE); + + } +} + +var c = new C(); +var other = new C(); + +hasProp(C.prototype, '#m', false, 'method is not defined in the prototype'); +hasProp(C, '#m', false, 'method is not defined in the contructor'); +hasProp(c, '#m', false, 'method cannot be seen outside of the class'); + +/*** + * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } + * + * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + * ... + */ +assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance'); + +assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference'); +ctorPromise.then(() => { + // gets the returned promise from #m + return c.ref().then(value => { + assert.sameValue(value, 42, 'function return'); + }); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-generator.js b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-generator.js new file mode 100644 index 0000000000..0ac3404b4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-generator.js @@ -0,0 +1,128 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-generator.case +// - src/class-elements/private-methods/cls-expr.template +/*--- +description: Private Generator (private method definitions in a class expression) +esid: prod-MethodDefinition +features: [generators, class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + GeneratorMethod + AsyncMethod + AsyncGeneratorMethod + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){GeneratorBody} + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody } + + AsyncGeneratorMethod : + async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + --- + + InitializeClassElements ( F, proto ) + + ... + 5. For each item element in order from elements, + a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name. + b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype", + i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto. + ii. Perform ? DefineClassElement(receiver, element). + + InitializeInstanceElements ( O, constructor ) + + ... + 3. Let elements be the value of F's [[Elements]] internal slot. + 4. For each item element in order from elements, + a. If element.[[Placement]] is "own" and element.[[Kind]] is "method", + i. Perform ? DefineClassElement(O, element). + + DefineClassElement (receiver, element) + + ... + 6. If key is a Private Name, + a. Perform ? PrivateFieldDefine(receiver, key, descriptor). + + PrivateFieldDefine (P, O, desc) + + ... + 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]]. + +---*/ + + +/*** + * template notes: + * 1. method should always be #m + * 2. the template provides c.ref/other.ref for external reference + */ + +function hasProp(obj, name, expected, msg) { + var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name); + assert.sameValue(hasOwnProperty, expected, msg); + + var hasProperty = Reflect.has(obj, name); + assert.sameValue(hasProperty, expected, msg); +} + +var C = class { + * #m() { return 42; } + + + get ref() { return this.#m; } + + constructor() { + hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties'); + assert.sameValue(typeof this.#m, 'function'); + assert.sameValue(this.ref, this.#m, 'returns the same value'); + assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms'); + + var res = this.#m().next(); + assert.sameValue(res.value, 42, 'return from generator method, inside ctor'); + assert.sameValue(res.done, true, 'iterator is done, inside ctor'); + assert.sameValue(this.#m.name, '#m', 'function name inside constructor'); + + } +} + +var c = new C(); +var other = new C(); + +hasProp(C.prototype, '#m', false, 'method is not defined in the prototype'); +hasProp(C, '#m', false, 'method is not defined in the contructor'); +hasProp(c, '#m', false, 'method cannot be seen outside of the class'); + +/*** + * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } + * + * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + * ... + */ +assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance'); + +// gets the returned iterator from #m +var res = c.ref().next(); +assert.sameValue(res.value, 42, 'return from generator method'); +assert.sameValue(res.done, true, 'iterator is done'); +assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js new file mode 100644 index 0000000000..53c6e4dec9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js @@ -0,0 +1,143 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method-initialize-order.case +// - src/class-elements/private-methods/cls-expr.template +/*--- +description: Private methods are added before any field initializer is run, even if they appear textually later (private method definitions in a class expression) +esid: prod-MethodDefinition +features: [class-methods-private, class-fields-private, class-fields-public, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + GeneratorMethod + AsyncMethod + AsyncGeneratorMethod + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){GeneratorBody} + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody } + + AsyncGeneratorMethod : + async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + --- + + InitializeClassElements ( F, proto ) + + ... + 5. For each item element in order from elements, + a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name. + b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype", + i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto. + ii. Perform ? DefineClassElement(receiver, element). + + InitializeInstanceElements ( O, constructor ) + + ... + 3. Let elements be the value of F's [[Elements]] internal slot. + 4. For each item element in order from elements, + a. If element.[[Placement]] is "own" and element.[[Kind]] is "method", + i. Perform ? DefineClassElement(O, element). + + DefineClassElement (receiver, element) + + ... + 6. If key is a Private Name, + a. Perform ? PrivateFieldDefine(receiver, key, descriptor). + + PrivateFieldDefine (P, O, desc) + + ... + 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]]. + + + InitializeInstanceElements ( O, constructor ) + ... + 4. For each item element in order from elements, + a. If element.[[Placement]] is "own" and element.[[Kind]] is "method", + i. Perform ? DefineClassElement(O, element). + 5. For each item element in order from elements, + a. If element.[[Placement]] is "own" and element.[[Kind]] is "field", + i. Assert: element.[[Descriptor]] does not have a [[Value]], [[Get]] or [[Set]] slot. + ii. Perform ? DefineClassElement(O, element). + 6. Return. + + EDITOR'S NOTE: + Value properties are added before initializers so that private methods are visible from all initializers. + +---*/ + + +/*** + * template notes: + * 1. method should always be #m + * 2. the template provides c.ref/other.ref for external reference + */ + +function hasProp(obj, name, expected, msg) { + var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name); + assert.sameValue(hasOwnProperty, expected, msg); + + var hasProperty = Reflect.has(obj, name); + assert.sameValue(hasProperty, expected, msg); +} + +var C = class { + a = this.#m(); + + #m() { return 42; } + get bGetter() { return this.#b; } + + #b = this.#m(); + + + get ref() { return this.#m; } + + constructor() { + hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties'); + assert.sameValue(typeof this.#m, 'function'); + assert.sameValue(this.ref, this.#m, 'returns the same value'); + assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms'); + + assert.sameValue(this.a, 42); + assert.sameValue(this.#b, 42); + + } +} + +var c = new C(); +var other = new C(); + +hasProp(C.prototype, '#m', false, 'method is not defined in the prototype'); +hasProp(C, '#m', false, 'method is not defined in the contructor'); +hasProp(c, '#m', false, 'method cannot be seen outside of the class'); + +/*** + * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } + * + * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + * ... + */ +assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance'); + +assert.sameValue(c.a, 42); +assert.sameValue(c.bGetter, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method.js b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method.js new file mode 100644 index 0000000000..eff2ef6d2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method.js @@ -0,0 +1,124 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method.case +// - src/class-elements/private-methods/cls-expr.template +/*--- +description: Private Method (private method definitions in a class expression) +esid: prod-MethodDefinition +features: [class, class-methods-private] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + GeneratorMethod + AsyncMethod + AsyncGeneratorMethod + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){GeneratorBody} + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody } + + AsyncGeneratorMethod : + async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + --- + + InitializeClassElements ( F, proto ) + + ... + 5. For each item element in order from elements, + a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name. + b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype", + i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto. + ii. Perform ? DefineClassElement(receiver, element). + + InitializeInstanceElements ( O, constructor ) + + ... + 3. Let elements be the value of F's [[Elements]] internal slot. + 4. For each item element in order from elements, + a. If element.[[Placement]] is "own" and element.[[Kind]] is "method", + i. Perform ? DefineClassElement(O, element). + + DefineClassElement (receiver, element) + + ... + 6. If key is a Private Name, + a. Perform ? PrivateFieldDefine(receiver, key, descriptor). + + PrivateFieldDefine (P, O, desc) + + ... + 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]]. + +---*/ + + +/*** + * template notes: + * 1. method should always be #m + * 2. the template provides c.ref/other.ref for external reference + */ + +function hasProp(obj, name, expected, msg) { + var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name); + assert.sameValue(hasOwnProperty, expected, msg); + + var hasProperty = Reflect.has(obj, name); + assert.sameValue(hasProperty, expected, msg); +} + +var C = class { + #m() { return 42; } + + + get ref() { return this.#m; } + + constructor() { + hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties'); + assert.sameValue(typeof this.#m, 'function'); + assert.sameValue(this.ref, this.#m, 'returns the same value'); + assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms'); + + assert.sameValue(this.#m(), 42, 'already defined in the ctor'); + assert.sameValue(this.#m.name, '#m', 'function name inside constructor'); + + } +} + +var c = new C(); +var other = new C(); + +hasProp(C.prototype, '#m', false, 'method is not defined in the prototype'); +hasProp(C, '#m', false, 'method is not defined in the contructor'); +hasProp(c, '#m', false, 'method cannot be seen outside of the class'); + +/*** + * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } + * + * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + * ... + */ +assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance'); + +// gets the returned value from #m +assert.sameValue(c.ref(), 42, 'function return'); +assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-methods/shell.js b/js/src/tests/test262/language/expressions/class/elements/private-methods/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-arrow-function.js new file mode 100644 index 0000000000..76acbeb323 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-arrow-function.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-access-on-inner-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private setter is visible on inner arrow function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + method() { + let arrowFunction = () => { + this.#m = 'Test262'; + } + + arrowFunction(); + } +} + +let c = new C(); +c.method(); +assert.sameValue(c._v, 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private setter from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-function.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-function.js new file mode 100644 index 0000000000..847dacdcc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-function.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-access-on-inner-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private setter is visible on inner function of class scope (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + method() { + let self = this; + function innerFunction() { + self.#m = 'Test262'; + } + + innerFunction(); + } +} + +let c = new C(); +c.method(); +assert.sameValue(c._v, 'Test262'); +let o = {}; +assert.throws(TypeError, function() { + c.method.call(o); +}, 'accessed private setter from an ordinary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-is-not-a-own-property.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-is-not-a-own-property.js new file mode 100644 index 0000000000..27f8cc72aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-is-not-a-own-property.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-is-not-a-own-property.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private setter is not stored as an own property of objects (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + a. Let entry be PrivateFieldFind(P, O). + b. If entry is empty, throw a TypeError exception. + c. Return entry.[[PrivateFieldValue]]. + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + 6. Else, + a. Assert: P.[[Kind]] is "accessor". + b. If P does not have a [[Get]] field, throw a TypeError exception. + c. Let getter be P.[[Get]]. + d. Return ? Call(getter, O). + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + checkPrivateSetter() { + assert.sameValue(this.hasOwnProperty("#m"), false); + assert.sameValue("#m" in this, false); + + assert.sameValue(this.__lookupSetter__("#m"), undefined); + + this.#m = "Test262"; + assert.sameValue(this._v, "Test262"); + + return 0; + } +} + +let c = new C(); +assert.sameValue(c.checkPrivateSetter(), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-on-nested-class.js new file mode 100644 index 0000000000..a5894821de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-on-nested-class.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private setter is available on inner classes (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + B = class { + method(o, v) { + o.#m = v; + } + } +} + +let c = new C(); +let innerB = new c.B(); +innerB.method(c, 'test262'); +assert.sameValue(c._v, 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-field-on-nested-class.js new file mode 100644 index 0000000000..4f844db5b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-field-on-nested-class.js @@ -0,0 +1,54 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-shadowed-by-field-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private setter can be shadowed on inner classes by a private field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + method(v) { this.#m = v; } + + B = class { + method(o, v) { + o.#m = v; + } + + get m() { return this.#m; } + + #m; + } +} + +let c = new C(); +let innerB = new c.B(); + +innerB.method(innerB, 'test262'); +assert.sameValue(innerB.m, 'test262'); + +c.method('outer class'); +assert.sameValue(c._v, 'outer class'); + +assert.throws(TypeError, function() { + innerB.method(c, 'foo'); +}, 'accessed inner class field from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-getter-on-nested-class.js new file mode 100644 index 0000000000..5cece2d956 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-shadowed-by-getter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private setter can be shadowed on inner classes by a private getter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + method(v) { this.#m = v; } + + B = class { + method(o, v) { + o.#m = v; + } + + get #m() { return 'test262'; } + } +} + +let c = new C(); +let innerB = new c.B(); + +assert.throws(TypeError, function() { + innerB.method(innerB); +}, 'invalid [[Set]] of an acessor without setter'); + +c.method('outer class'); +assert.sameValue(c._v, 'outer class'); + +assert.throws(TypeError, function() { + innerB.method(c); +}, 'invalid access of inner class getter from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-method-on-nested-class.js new file mode 100644 index 0000000000..5c83e5d3e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-method-on-nested-class.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-shadowed-by-method-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private setter can be shadowed on inner class by a private method (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + method(v) { this.#m = v; } + + B = class { + method(o, v) { + o.#m = v; + } + + #m() { return 'test262'; } + } +} + +let c = new C(); +let innerB = new c.B(); + +assert.throws(TypeError, function() { + innerB.method(innerB, 'foo'); +}, 'invalid [[Set]] operation in a private method'); + +c.method('outer class'); +assert.sameValue(c._v, 'outer class'); + +assert.throws(TypeError, function() { + innerB.method(c); +}, 'invalid access of inner class method from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-setter-on-nested-class.js new file mode 100644 index 0000000000..5d59aa65d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,52 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-setter-shadowed-by-setter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private setter can be shadowed on inner classes by a private setter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + set #m(v) { this._v = v; } + + method(v) { this.#m = v; } + + B = class { + method(o, v) { + o.#m = v; + } + + set #m(v) { this._v = v; } + } +} + +let c = new C(); +let innerB = new c.B(); + +innerB.method(innerB, 'test262'); +assert.sameValue(innerB._v, 'test262'); + +c.method('outer class'); +assert.sameValue(c._v, 'outer class'); + +assert.throws(TypeError, function() { + innerB.method(c, 'foo'); +}, 'access of inner class accessor from an object of outer class'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-async-generator-method-name.js b/js/src/tests/test262/language/expressions/class/elements/private-static-async-generator-method-name.js new file mode 100644 index 0000000000..34937bea3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-async-generator-method-name.js @@ -0,0 +1,63 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-async-generator-method-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private static async generator methods have name property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : static MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static". + + AsyncMethod : async [no LineTerminator here] * ClassElementName (UniqueFormalParameters) { AsyncFunctionBody } + ... + 12. Perform ? DefineOrdinaryMethod(key, homeObject, closure, _enumerable). + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + ClassElementName : PrivateIdentifier + 1. Let bindingName be StringValue of PrivateIdentifier. + ... + 5. If scopeEnvRec's binding for bindingName is uninitialized, + a. Let field be NewPrivateName(bindingName). + b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field). + 6. Otherwise, + a. Let field be scopeEnvRec.GetBindingValue(bindingName). + 7. Assert: field.[[Description]] is bindingName. + 8. Return field. + + DefineOrdinaryMethod(key, homeObject, closure, enumerable) + 1. Perform SetFunctionName(closure, key). + 2. If key is a Private Name, + a. Assert: key does not have a [[Kind]] field. + b. Set key.[[Kind]] to "method". + c. Set key.[[Value]] to closure. + d. Set key.[[Brand]] to homeObject. + 3. Else, + a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). + +---*/ + + +var C = class { + static async * #method() {}; + + static getPrivateMethod() { + return this.#method; + } +} + +assert.sameValue(C.getPrivateMethod().name, "#method"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-async-method-name.js b/js/src/tests/test262/language/expressions/class/elements/private-static-async-method-name.js new file mode 100644 index 0000000000..cc013d5f69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-async-method-name.js @@ -0,0 +1,63 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-async-method-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private static async methods have name property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : static MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static". + + AsyncMethod : async [no LineTerminator here] ClassElementName (UniqueFormalParameters) { AsyncFunctionBody } + ... + 10. Perform ? DefineOrdinaryMethod(key, homeObject, closure, _enumerable). + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + ClassElementName : PrivateIdentifier + 1. Let bindingName be StringValue of PrivateIdentifier. + ... + 5. If scopeEnvRec's binding for bindingName is uninitialized, + a. Let field be NewPrivateName(bindingName). + b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field). + 6. Otherwise, + a. Let field be scopeEnvRec.GetBindingValue(bindingName). + 7. Assert: field.[[Description]] is bindingName. + 8. Return field. + + DefineOrdinaryMethod(key, homeObject, closure, enumerable) + 1. Perform SetFunctionName(closure, key). + 2. If key is a Private Name, + a. Assert: key does not have a [[Kind]] field. + b. Set key.[[Kind]] to "method". + c. Set key.[[Value]] to closure. + d. Set key.[[Brand]] to homeObject. + 3. Else, + a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). + +---*/ + + +var C = class { + static async #method() {}; + + static getPrivateMethod() { + return this.#method; + } +} + +assert.sameValue(C.getPrivateMethod().name, "#method"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-field-on-nested-class.js new file mode 100644 index 0000000000..1eb3a4e955 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-field-on-nested-class.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-field-shadowed-by-field-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static field can be shadowed on inner classes by a private field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-private, class-static-fields-public, class-fields-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m = 'outer class'; + + static fieldAccess() { + return this.#m; + } + + static B = class { + #m = 'inner class'; + static fieldAccess(o) { + return o.#m; + } + } +} + +assert.sameValue(C.fieldAccess(), 'outer class'); + +let b = new C.B(); + +assert.sameValue(C.B.fieldAccess(b), 'inner class'); + +assert.throws(TypeError, function() { + C.B.fieldAccess(C); +}, 'accessed private field from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js new file mode 100644 index 0000000000..737f41b497 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-field-shadowed-by-getter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static field can be shadowed on inner classes by a private getter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-private, class-static-fields-public, class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m = 'outer class'; + + static fieldAccess() { + return this.#m; + } + + static B = class { + get #m() { return 'inner class'; } + + static access(o) { + return o.#m; + } + } +} + +assert.sameValue(C.fieldAccess(), 'outer class'); + +let b = new C.B(); + +assert.sameValue(C.B.access(b), 'inner class'); + +assert.throws(TypeError, function() { + C.B.access(C); +}, 'accessed private getter from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-method-on-nested-class.js new file mode 100644 index 0000000000..aa1b10a60f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-method-on-nested-class.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-field-shadowed-by-method-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static field can be shadowed on inner classes by a private method (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-private, class-static-fields-public, class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m = () => 'outer class'; + + static fieldAccess() { + return this.#m(); + } + + static B = class { + #m() { return 'inner class'; } + + static access(o) { + return o.#m(); + } + } +} + +assert.sameValue(C.fieldAccess(), 'outer class'); + +let b = new C.B(); + +assert.sameValue(C.B.access(b), 'inner class'); + +assert.throws(TypeError, function() { + C.B.access(C); +}, 'accessed private method from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js new file mode 100644 index 0000000000..c85edfbd0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,94 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-field-shadowed-by-setter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static field can be shadowed on inner classes by a private setter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-private, class-static-fields-public, class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m = 'outer class'; + + static fieldAccess() { + return this.#m; + } + + static B = class { + set #m(v) { this._v = v; } + + static access(o) { + o.#m = 'inner class'; + } + } +} + +assert.sameValue(C.fieldAccess(), 'outer class'); + +let b = new C.B(); + +C.B.access(b); +assert.sameValue(b._v, 'inner class'); + +assert.throws(TypeError, function() { + C.B.access(C); +}, 'accessed private setter from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-field-usage-inside-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-field-usage-inside-nested-class.js new file mode 100644 index 0000000000..5d54578797 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-usage-inside-nested-class.js @@ -0,0 +1,82 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-field-usage-inside-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static field is available inside inner classes (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-private, class-static-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m = 'outer class'; + + static B = class { + static fieldAccess(o) { + return o.#m; + } + } +} + +assert.sameValue(C.B.fieldAccess(C), 'outer class'); +assert.throws(TypeError, function() { + C.B.methodAccess(C.B); +}, 'accessed static private field from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-generator-method-name.js b/js/src/tests/test262/language/expressions/class/elements/private-static-generator-method-name.js new file mode 100644 index 0000000000..f5154d041d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-generator-method-name.js @@ -0,0 +1,63 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-generator-method-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private static generator methods have name property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : static MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static". + + GeneratorMethod : * ClassElementName (UniqueFormalParameters) { GeneratorBody } + ... + 12. Perform ? DefineOrdinaryMethod(key, homeObject, closure, _enumerable). + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + ClassElementName : PrivateIdentifier + 1. Let bindingName be StringValue of PrivateIdentifier. + ... + 5. If scopeEnvRec's binding for bindingName is uninitialized, + a. Let field be NewPrivateName(bindingName). + b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field). + 6. Otherwise, + a. Let field be scopeEnvRec.GetBindingValue(bindingName). + 7. Assert: field.[[Description]] is bindingName. + 8. Return field. + + DefineOrdinaryMethod(key, homeObject, closure, enumerable) + 1. Perform SetFunctionName(closure, key). + 2. If key is a Private Name, + a. Assert: key does not have a [[Kind]] field. + b. Set key.[[Kind]] to "method". + c. Set key.[[Value]] to closure. + d. Set key.[[Brand]] to homeObject. + 3. Else, + a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). + +---*/ + + +var C = class { + static * #method() {}; + + static getPrivateMethod() { + return this.#method; + } +} + +assert.sameValue(C.getPrivateMethod().name, "#method"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-method-length.js b/js/src/tests/test262/language/expressions/class/elements/private-static-method-length.js new file mode 100644 index 0000000000..fe5ff5d365 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-length.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-method-length.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private static methods have length property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : static MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static". + + MethodDefinition : ClassElementName( UniqueFormalParameters ) { FunctionBody } + 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + 2. ReturnIfAbrupt(methodDef). + 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable). + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + MethodDefinition : ClassElementName (UniqueFormalParameters) { FunctionBody } + ... + 8. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, privateScope, strict, prototype). + 9. Perform MakeMethod(closure, object). + 10. Return the Record{[[Key]]: propKey, [[Closure]]: closure}. + +---*/ + + +var C = class { + static #method(a, b, c) {}; + + static getPrivateMethod() { + return this.#method; + } + +} + +assert.sameValue(C.getPrivateMethod().length, 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-method-name.js b/js/src/tests/test262/language/expressions/class/elements/private-static-method-name.js new file mode 100644 index 0000000000..8c6c917c8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-name.js @@ -0,0 +1,74 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-method-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private static methods have name property properly configured (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". + + ClassElement : static MethodDefinition + 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static". + + MethodDefinition : ClassElementName( UniqueFormalParameters ) { FunctionBody } + 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + 2. ReturnIfAbrupt(methodDef). + 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable). + + ClassElement : MethodDefinition + ClassElement : static MethodDefinition + 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. + 2. Return empty. + + MethodDefinition : ClassElementName (UniqueFormalParameters) { FunctionBody } + 1. Let propKey be the result of evaluating ClassElementName. + ... + 8. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, privateScope, strict, prototype). + 9. Perform MakeMethod(closure, object). + 10. Return the Record{[[Key]]: propKey, [[Closure]]: closure}. + + ClassElementName : PrivateIdentifier + 1. Let bindingName be StringValue of PrivateIdentifier. + ... + 5. If scopeEnvRec's binding for bindingName is uninitialized, + a. Let field be NewPrivateName(bindingName). + b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field). + 6. Otherwise, + a. Let field be scopeEnvRec.GetBindingValue(bindingName). + 7. Assert: field.[[Description]] is bindingName. + 8. Return field. + + DefineOrdinaryMethod(key, homeObject, closure, enumerable) + 1. Perform SetFunctionName(closure, key). + 2. If key is a Private Name, + a. Assert: key does not have a [[Kind]] field. + b. Set key.[[Kind]] to "method". + c. Set key.[[Value]] to closure. + d. Set key.[[Brand]] to homeObject. + 3. Else, + a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). + +---*/ + + +var C = class { + static #method() { + return 'Test262'; + }; + + static getPrivateMethod() { + return this.#method; + } + +} + +assert.sameValue(C.getPrivateMethod().name, "#method"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-field-on-nested-class.js new file mode 100644 index 0000000000..84fe94c2dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-field-on-nested-class.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-method-shadowed-by-field-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static method can be shadowed on inner classes by a private field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-public, class-fields-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m() { return 'outer class'; } + + static methodAccess() { + return this.#m(); + } + + static B = class { + #m = 'inner class'; + static fieldAccess(o) { + return o.#m; + } + } +} + +assert.sameValue(C.methodAccess(), 'outer class'); + +let b = new C.B(); + +assert.sameValue(C.B.fieldAccess(b), 'inner class'); + +assert.throws(TypeError, function() { + C.B.fieldAccess(C); +}, 'accessed private field from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js new file mode 100644 index 0000000000..55ea7495ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-method-shadowed-by-getter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static method can be shadowed on inner classes by a private getter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-public, class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m() { return 'outer class'; } + + static methodAccess() { + return this.#m(); + } + + static B = class { + get #m() { return 'inner class'; } + + static access(o) { + return o.#m; + } + } +} + +assert.sameValue(C.methodAccess(), 'outer class'); + +let b = new C.B(); + +assert.sameValue(C.B.access(b), 'inner class'); + +assert.throws(TypeError, function() { + C.B.access(C); +}, 'accessed private getter from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-method-on-nested-class.js new file mode 100644 index 0000000000..591cb9c56d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-method-on-nested-class.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-method-shadowed-by-method-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static method can be shadowed on inner classes by a private method (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-public, class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m() { return 'outer class'; } + + static methodAccess() { + return this.#m(); + } + + static B = class { + #m() { return 'inner class'; } + + static access(o) { + return o.#m(); + } + } +} + +assert.sameValue(C.methodAccess(), 'outer class'); + +let b = new C.B(); + +assert.sameValue(C.B.access(b), 'inner class'); + +assert.throws(TypeError, function() { + C.B.access(C); +}, 'accessed private method from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js new file mode 100644 index 0000000000..7608609a85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,94 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-method-shadowed-by-setter-on-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static method can be shadowed on inner classes by a private setter (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-public, class-methods-private, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m() { return 'outer class'; } + + static methodAccess() { + return this.#m(); + } + + static B = class { + set #m(v) { this._v = v; } + + static access(o) { + o.#m = 'inner class'; + } + } +} + +assert.sameValue(C.methodAccess(), 'outer class'); + +let b = new C.B(); + +C.B.access(b); +assert.sameValue(b._v, 'inner class'); + +assert.throws(TypeError, function() { + C.B.access(C); +}, 'accessed private setter from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-static-method-usage-inside-nested-class.js b/js/src/tests/test262/language/expressions/class/elements/private-static-method-usage-inside-nested-class.js new file mode 100644 index 0000000000..bf9f7fe90c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-usage-inside-nested-class.js @@ -0,0 +1,84 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-static-method-usage-inside-nested-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: PrivateName of private static method is available inside inner classes (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-public, class] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateIdentifier + + ClassTail : ClassHeritage { ClassBody } + ... + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + FieldDefinition : ClassElementName Initializer_opt + 1. Let name be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(name). + 3. If Initializer_opt is present, + a. Let lex be the Lexical Environment of the running execution context. + b. Let formalParameterList be an instance of the production FormalParameters : [empty]. + c. Let privateScope be the PrivateEnvironment of the running execution context. + d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope). + e. Perform MakeMethod(initializer, homeObject). + f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer). + 4. Else, + a. Let initializer be empty. + b. Let isAnonymousFunctionDeclaration be false. + 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }. + + MemberExpression : MemberExpression.PrivateIdentifier + 1. Let baseReference be the result of evaluating MemberExpression. + 2. Let baseValue be ? GetValue(baseReference). + 3. Let bv be ? RequireObjectCoercible(baseValue). + 4. Let fieldNameString be the StringValue of PrivateIdentifier. + 5. Return MakePrivateReference(bv, fieldNameString). + + MakePrivateReference(baseValue, privateIdentifier) + 1. Let env be the running execution context's PrivateEnvironment. + 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env). + 3. Let privateName be GetValue(privateNameBinding). + 4. Assert: privateName is a Private Name. + 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true. + +---*/ + + +var C = class { + static #m() { + return 'outer class'; + } + + static B = class { + static methodAccess(o) { + return o.#m(); + } + } +} + +assert.sameValue(C.B.methodAccess(C), 'outer class'); +assert.throws(TypeError, function() { + C.B.methodAccess(C.B); +}, 'accessed static private method from an arbritary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-arguments.js new file mode 100644 index 0000000000..cc452bce75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-ternary.template +/*--- +description: Syntax error if `arguments` used in class field (private field, ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = true ? {} : arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-super.js new file mode 100644 index 0000000000..92a8318694 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-ternary-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-ternary.template +/*--- +description: Syntax error if `super()` used in class field (private field, ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = true ? {} : super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-arguments.js new file mode 100644 index 0000000000..a07f7fdf5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-private-typeof.template +/*--- +description: Syntax error if `arguments` used in class field (private field, typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = typeof arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-super.js new file mode 100644 index 0000000000..043fc87e8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-typeof-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-private-typeof.template +/*--- +description: Syntax error if `super()` used in class field (private field, typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = typeof super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js b/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js new file mode 100644 index 0000000000..c3756b8080 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-getter-before-super-return-in-constructor.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private getters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m; } + get #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private getters are not installed before super returns'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js b/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..b1e1443ab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-getter-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private getters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + f = this.g(); + +} + +class D extends C { + g() { this.#m; } + get #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private getters are not installed before super returns'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js b/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js new file mode 100644 index 0000000000..90664bbb19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method-before-super-return-in-constructor.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private methods are installed "when super returns" and no earlier (call in constructor) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m(); } + #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private methods are not installed before super returns'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js b/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..f192db3e1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private methods are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + f = this.g(); + +} + +class D extends C { + g() { this.#m(); } + #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private methods are not installed before super returns'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js b/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js new file mode 100644 index 0000000000..20cc5b74b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-setter-before-super-return-in-constructor.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private setters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m = 42; } + set #m(val) {} +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private setters are not installed before super returns'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js b/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..8f28a663e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-setter-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private settters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-public, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + f = this.g(); + +} + +class D extends C { + g() { this.#m = 42; } + set #m(val) {} +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private setters are not installed before super returns'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/redeclaration-symbol.js b/js/src/tests/test262/language/expressions/class/elements/redeclaration-symbol.js new file mode 100644 index 0000000000..76543d7766 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/redeclaration-symbol.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/redeclaration-symbol.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Redeclaration of public fields with the same name (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js, compareArray.js] +info: | + 2.13.2 Runtime Semantics: ClassDefinitionEvaluation + + ... + 30. Set the value of F's [[Fields]] internal slot to fieldRecords. + ... + + 2.14 [[Construct]] ( argumentsList, newTarget) + + ... + 8. If kind is "base", then + ... + b. Let result be InitializeInstanceFields(thisArgument, F). + ... + + 2.9 InitializeInstanceFields ( O, constructor ) + + 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot. + 4. For each item fieldRecord in order from fieldRecords, + a. If fieldRecord.[[static]] is false, then + i. Perform ? DefineField(O, fieldRecord). + +---*/ +var x = []; +var y = Symbol(); + + +var C = class { + [y] = (x.push("a"), "old_value"); + [y] = (x.push("b"), "same_value"); + [y] = (x.push("c"), "same_value"); +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: "same_value", + enumerable: true, + writable: true, + configurable: true +}); + +assert(compareArray(x, ["a", "b", "c"])); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/redeclaration.js b/js/src/tests/test262/language/expressions/class/elements/redeclaration.js new file mode 100644 index 0000000000..14352deff3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/redeclaration.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/redeclaration.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Redeclaration of public fields with the same name (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js, compareArray.js] +info: | + 2.13.2 Runtime Semantics: ClassDefinitionEvaluation + + ... + 30. Set the value of F's [[Fields]] internal slot to fieldRecords. + ... + + 2.14 [[Construct]] ( argumentsList, newTarget) + + ... + 8. If kind is "base", then + ... + b. Let result be InitializeInstanceFields(thisArgument, F). + ... + + 2.9 InitializeInstanceFields ( O, constructor ) + + 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot. + 4. For each item fieldRecord in order from fieldRecords, + a. If fieldRecord.[[static]] is false, then + i. Perform ? DefineField(O, fieldRecord). + +---*/ +var x = []; + + +var C = class { + y = (x.push("a"), "old_value"); + ["y"] = (x.push("b"), "another_value"); + "y" = (x.push("c"), "same_value"); + y = (x.push("d"), "same_value"); +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); + +verifyProperty(c, "y", { + value: "same_value", + enumerable: true, + writable: true, + configurable: true +}); + +assert(compareArray(x, ["a", "b", "c", "d"])); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-names.js new file mode 100644 index 0000000000..30a388c7b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-names.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Computed property names (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + [x] = 42; [10] = "meep"; ["not initialized"] + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-symbol-names.js new file mode 100644 index 0000000000..1be73c60f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-symbol-names.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Computed property symbol names (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..c6f7c03f3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,96 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: PrivateName Static Semantics, StringValue (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names-asi.js new file mode 100644 index 0000000000..ce426f2474 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names-asi.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Literal property names with ASI (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names.js new file mode 100644 index 0000000000..86c754c1c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Literal property names (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-field-usage.js new file mode 100644 index 0000000000..14e46ad26b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-field-usage.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: PrivateName CallExpression usage (private field) (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = 'test262'; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-getter-usage.js new file mode 100644 index 0000000000..9c32d91119 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-getter-usage.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-usage.js new file mode 100644 index 0000000000..f43b56cc8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-usage.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: PrivateName CallExpression usage (private method) (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; } + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-names.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-names.js new file mode 100644 index 0000000000..2df7244d4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-names.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: private names (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + #x; #y + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..8a8084864b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier-initializer.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid FieldDefinition (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1 + +} + +var c = new C(); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier.js new file mode 100644 index 0000000000..67360b17c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-field-identifier.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid FieldDefinition (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J + +} + +var c = new C(); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter-alt.js new file mode 100644 index 0000000000..b6e8beaed4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter-alt.js @@ -0,0 +1,115 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName as private getter (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter.js new file mode 100644 index 0000000000..dce78c6159 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter.js @@ -0,0 +1,115 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName as private getter (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method-alt.js new file mode 100644 index 0000000000..f7e37875c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method-alt.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName as private method (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } + + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method.js new file mode 100644 index 0000000000..a04c43e25c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName as private method (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } + + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter-alt.js new file mode 100644 index 0000000000..ce76e12a0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter-alt.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName as private setter (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } + + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter.js new file mode 100644 index 0000000000..b0a693c032 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName as private setter (regular fields defintion) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } + + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..5d98aa7462 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-alt.js @@ -0,0 +1,96 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..06194c992a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1 + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..ea206c8a7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer.js @@ -0,0 +1,90 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1 + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier.js new file mode 100644 index 0000000000..ab3e1bb583 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier.js @@ -0,0 +1,96 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..742a9126cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..3965c1c1fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..aff3ea04fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static AsyncMethod PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..03e3239978 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,121 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static AsyncMethod PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..50f112ebea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,111 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static GeneratorMethod PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..a87bd6aa6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,112 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static GeneratorMethod PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..5daa86f19f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static Method PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..29ffd07c35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier.js @@ -0,0 +1,109 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static Method PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..d7e98c8911 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,97 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..f40ca80b52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js @@ -0,0 +1,97 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..d4f8c7fb57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,97 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..255005b797 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,91 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..ac241e0fb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,91 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1 + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..290251f504 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,91 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1 + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..88127a606f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier.js @@ -0,0 +1,97 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: Valid Static PrivateName (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-fields.js new file mode 100644 index 0000000000..3197107813 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-fields.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: static private fields (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x; static #y + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..8df4f92eaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods-with-fields.js @@ -0,0 +1,75 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: static private methods with fields (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods.js new file mode 100644 index 0000000000..4ee55bef42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods.js @@ -0,0 +1,62 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: static private methods (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/regular-definitions-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-string-literal-names.js new file mode 100644 index 0000000000..7b218fbb3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-string-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-regular-definitions.template +/*--- +description: String literal names (regular fields defintion) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42 + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-names.js new file mode 100644 index 0000000000..70774ec75f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-names.js @@ -0,0 +1,90 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Computed property names (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + async *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + + verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-symbol-names.js new file mode 100644 index 0000000000..9629cd82c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-symbol-names.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Computed property symbol names (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + async *m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); + assert.sameValue(Object.hasOwnProperty.call(C, x), false); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); + assert.sameValue(Object.hasOwnProperty.call(C, y), false); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..0c67cc1b7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + async *m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names-asi.js new file mode 100644 index 0000000000..63b57e3b5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names-asi.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Literal property names with ASI (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async *m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names.js new file mode 100644 index 0000000000..4ded10bb9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Literal property names (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + async *m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true + }); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-field-usage.js new file mode 100644 index 0000000000..c0591de080 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-field-usage.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + async *m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-getter-usage.js new file mode 100644 index 0000000000..330a81fedd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-getter-usage.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + async *m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-usage.js new file mode 100644 index 0000000000..5241054785 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-usage.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + async *m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-names.js new file mode 100644 index 0000000000..8df5fe06fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-names.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: private names (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async *m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..ecdb3ab459 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier-initializer.js @@ -0,0 +1,97 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid FieldDefinition (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier.js new file mode 100644 index 0000000000..ac711b6ec1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier.js @@ -0,0 +1,104 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid FieldDefinition (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter-alt.js new file mode 100644 index 0000000000..9df50a29b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter-alt.js @@ -0,0 +1,138 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter.js new file mode 100644 index 0000000000..c688449273 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter.js @@ -0,0 +1,138 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName as private getter (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method-alt.js new file mode 100644 index 0000000000..76d037ab9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method-alt.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method.js new file mode 100644 index 0000000000..43004b27b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName as private method (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter-alt.js new file mode 100644 index 0000000000..bc47cac77b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter-alt.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter.js new file mode 100644 index 0000000000..db05ffadb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName as private setter (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..52ba4e2a2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..49bb187a5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..4f1bf49170 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier.js new file mode 100644 index 0000000000..35886b66a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..4a7905e6c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..b1718abb74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,146 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..6c32a50eba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..2381b32df7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,146 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..d9b67c2641 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,134 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.o([1]).next().value, 1); + assert.sameValue(C.℘([1]).next().value, 1); + assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..7790202904 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,135 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.\u{6F}([1]).next().value, 1); + assert.sameValue(C.\u2118([1]).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..cf60f4bd17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..dcfa159cfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static Method PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..bdfe1e6f72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..8725d34d35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..9c83eaa1d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..1473e3a915 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..d4cf98a57b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..7db44845e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..de2e6c3e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Valid Static PrivateName (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-fields.js new file mode 100644 index 0000000000..e6a621bdd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-fields.js @@ -0,0 +1,81 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: static private fields (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async *m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..7476029b2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods-with-fields.js @@ -0,0 +1,98 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: static private methods with fields (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods.js new file mode 100644 index 0000000000..9a666e423a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods.js @@ -0,0 +1,85 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: static private methods (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async *m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-string-literal-names.js new file mode 100644 index 0000000000..55e6abb26a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-string-literal-names.js @@ -0,0 +1,95 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: String literal names (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-names.js new file mode 100644 index 0000000000..b07e137f50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-names.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Computed property names (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + async m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"]; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + + verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-symbol-names.js new file mode 100644 index 0000000000..fa071118b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-symbol-names.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Computed property symbol names (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + async m() { return 42; } [x]; [y] = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); + assert.sameValue(Object.hasOwnProperty.call(C, x), false); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); + assert.sameValue(Object.hasOwnProperty.call(C, y), false); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); + assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..334661d9c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,118 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + async m() { return 42; } #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names-asi.js new file mode 100644 index 0000000000..72093a9fde --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names-asi.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Literal property names with ASI (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async m() { return 42; } a + b = 42;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names.js new file mode 100644 index 0000000000..4cfe247e88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names.js @@ -0,0 +1,87 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Literal property names (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + async m() { return 42; } a; b = 42; + c = fn; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true + }); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-field-usage.js new file mode 100644 index 0000000000..396b5183cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-field-usage.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + async m() { return 42; } #m = 'test262';; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-getter-usage.js new file mode 100644 index 0000000000..950a267465 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-getter-usage.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + async m() { return 42; } get #m() { return 'test262'; }; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-usage.js new file mode 100644 index 0000000000..7e29ac0e5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-usage.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + async m() { return 42; } #m() { return 'test262'; }; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.method(), 'test262'); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-names.js new file mode 100644 index 0000000000..51b7046cb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-names.js @@ -0,0 +1,80 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: private names (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async m() { return 42; } #x; #y; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..4f662eb8aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier-initializer.js @@ -0,0 +1,96 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid FieldDefinition (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier.js new file mode 100644 index 0000000000..0cfe6d21d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier.js @@ -0,0 +1,103 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid FieldDefinition (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter-alt.js new file mode 100644 index 0000000000..e314bffffd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter-alt.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter.js new file mode 100644 index 0000000000..6f8aecec7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter.js @@ -0,0 +1,137 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName as private getter (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method-alt.js new file mode 100644 index 0000000000..df81c3ebb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method-alt.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName as private method (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method.js new file mode 100644 index 0000000000..6df25833ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName as private method (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter-alt.js new file mode 100644 index 0000000000..e4679975a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter-alt.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter.js new file mode 100644 index 0000000000..d07b0ea7ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter.js @@ -0,0 +1,136 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName as private setter (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..0f7a376b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-alt.js @@ -0,0 +1,118 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..722f6e7c5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,112 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..e8f01736a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,112 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier.js new file mode 100644 index 0000000000..fa4aae5c09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier.js @@ -0,0 +1,118 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..d82d25de51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..a5f9bbc731 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..33d0fa80c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,144 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..aed76c842f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,145 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..b3633c9219 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,133 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.o([1]).next().value, 1); + assert.sameValue(C.℘([1]).next().value, 1); + assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..46f102e116 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,134 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$([1]).next().value, 1); + assert.sameValue(C._([1]).next().value, 1); + assert.sameValue(C.\u{6F}([1]).next().value, 1); + assert.sameValue(C.\u2118([1]).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); + assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..2ec082e38e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..a2f41ca74d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static Method PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..80693d063b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..6c78e703fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..b4b8cd90dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..3f2e1c9d05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..ae7a8292dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..d8f7fbed6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..079b69beac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier.js @@ -0,0 +1,119 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Valid Static PrivateName (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-fields.js new file mode 100644 index 0000000000..4b0c2d31d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-fields.js @@ -0,0 +1,80 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: static private fields (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async m() { return 42; } static #x; static #y; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..418ac6868d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: static private methods with fields (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods.js new file mode 100644 index 0000000000..4ed7b1ffcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods.js @@ -0,0 +1,84 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: static private methods (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async m() { return 42; } ; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-string-literal-names.js new file mode 100644 index 0000000000..4e65a4b63c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-string-literal-names.js @@ -0,0 +1,94 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-after-same-line-async-method.template +/*--- +description: String literal names (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + } + + return Promise.resolve(assertions()); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-names.js new file mode 100644 index 0000000000..a8ab780c6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-names.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Computed property names (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + [x] = 42; [10] = "meep"; ["not initialized"]; *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000..b5b7fd8d97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-symbol-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Computed property symbol names (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..587bbf1b0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; *m() { return 42; } + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names-asi.js new file mode 100644 index 0000000000..bc9719c730 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names-asi.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Literal property names with ASI (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42;; *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names.js new file mode 100644 index 0000000000..4650dc5fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Literal property names (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-field-usage.js new file mode 100644 index 0000000000..437c059d33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-field-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = 'test262';; *m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-getter-usage.js new file mode 100644 index 0000000000..f5443d16ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-getter-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; }; *m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-usage.js new file mode 100644 index 0000000000..da8ac6f6d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; }; *m() { return 42; } + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-names.js new file mode 100644 index 0000000000..deff46eb67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-names.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: private names (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + #x; #y; *m() { return 42; } + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..2374ac69ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier-initializer.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid FieldDefinition (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier.js new file mode 100644 index 0000000000..d514d0a26b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid FieldDefinition (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter-alt.js new file mode 100644 index 0000000000..41d036ea98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter.js new file mode 100644 index 0000000000..b075f601c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method-alt.js new file mode 100644 index 0000000000..63ae01e967 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method.js new file mode 100644 index 0000000000..6315c2dae1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; *m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter-alt.js new file mode 100644 index 0000000000..b8491bffc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter.js new file mode 100644 index 0000000000..64486cc37b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..c0852ace05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..59bf82f66c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; *m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..9bf6094eb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; *m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier.js new file mode 100644 index 0000000000..1865ad6311 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; *m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..25c3e97503 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..7ff7d5e9e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..0e959f77d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; *m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..e02b93cac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; *m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..ec8f1e09c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..fb9698f0ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; *m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..8a68c5694a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; *m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..fe5d1ada89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; *m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..2ed2c33eb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; *m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..9fb0602b91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; *m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..8d638a403c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; *m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..6c44cdcc74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; *m() { return 42; } + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..96fec88b26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; *m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..11748d870f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; *m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..63f0921e52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: Valid Static PrivateName (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; *m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-fields.js new file mode 100644 index 0000000000..d0414d3865 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-fields.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: static private fields (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x; static #y; *m() { return 42; } + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..189d2b9278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: static private methods with fields (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; *m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods.js new file mode 100644 index 0000000000..1ba8ed061d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods.js @@ -0,0 +1,73 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: static private methods (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ; *m() { return 42; } + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-gen-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-string-literal-names.js new file mode 100644 index 0000000000..a45224dd5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-string-literal-names.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-same-line-generator.template +/*--- +description: String literal names (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; *m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-names.js new file mode 100644 index 0000000000..639553c318 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-names.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + [x] = 42; [10] = "meep"; ["not initialized"]; m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-symbol-names.js new file mode 100644 index 0000000000..cf5a452250 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-symbol-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..6b6de21a65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: PrivateName Static Semantics, StringValue (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;; m() { return 42; } + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names-asi.js new file mode 100644 index 0000000000..298a2f3bac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names-asi.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42;; m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names.js new file mode 100644 index 0000000000..13b432a4b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-field-usage.js new file mode 100644 index 0000000000..d73a02eb2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-field-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: PrivateName CallExpression usage (private field) (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m = 'test262';; m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-getter-usage.js new file mode 100644 index 0000000000..d72942e37d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-getter-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + get #m() { return 'test262'; }; m() { return 42; } + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-usage.js new file mode 100644 index 0000000000..3fbf7d6969 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-usage.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: PrivateName CallExpression usage (private method) (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + #m() { return 'test262'; }; m() { return 42; } + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-names.js new file mode 100644 index 0000000000..897de69a3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-names.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: private names (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + #x; #y; m() { return 42; } + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..e9d7c723fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier.js new file mode 100644 index 0000000000..2561fd6f26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid FieldDefinition (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter-alt.js new file mode 100644 index 0000000000..de08c6ae78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter-alt.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter.js new file mode 100644 index 0000000000..9a6feca60e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter.js @@ -0,0 +1,126 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName as private getter (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method-alt.js new file mode 100644 index 0000000000..0a33010e42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +; m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method.js new file mode 100644 index 0000000000..65e5003f5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName as private method (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +; m() { return 42; } + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter-alt.js new file mode 100644 index 0000000000..5d48657538 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter-alt.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +; m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter.js new file mode 100644 index 0000000000..e31ff57c52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter.js @@ -0,0 +1,125 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName as private setter (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +; m() { return 42; } + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..0478453faa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..a2b64b9367 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..9b0541b1db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,101 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; m() { return 42; } + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier.js new file mode 100644 index 0000000000..42734250bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier.js @@ -0,0 +1,107 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; m() { return 42; } + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..4841867c9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + }; m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..06fc4649c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + }; m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..11150fc70e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,131 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + }; m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..7bdc52abcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,132 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + }; m() { return 42; } + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..8ec132378e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + }; m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..70ce58d40f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + }; m() { return 42; } + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..5def7b7f58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + }; m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..861ca3f43f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,120 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static Method PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + }; m() { return 42; } + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..282d904556 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..079740e7b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..ab7c38cd54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; m() { return 42; } + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..badac8dd25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; m() { return 42; } + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..3f554b878d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..efe91c3498 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,102 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; m() { return 42; } + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..8f7fc1dd87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,108 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: Valid Static PrivateName (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; m() { return 42; } + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-fields.js new file mode 100644 index 0000000000..c3947aaf42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-fields.js @@ -0,0 +1,69 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: static private fields (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #x; static #y; m() { return 42; } + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..068231f7a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,86 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods.js new file mode 100644 index 0000000000..3a893841fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods.js @@ -0,0 +1,73 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: static private methods (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ; m() { return 42; } + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/same-line-method-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/same-line-method-string-literal-names.js new file mode 100644 index 0000000000..2715eae479 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-string-literal-names.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-same-line-method.template +/*--- +description: String literal names (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; m() { return 42; } + +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/shell.js b/js/src/tests/test262/language/expressions/class/elements/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field-assigned.js b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field-assigned.js new file mode 100644 index 0000000000..208b48a8db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field-assigned.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-instance-field-assigned.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static is a valid name of an instance field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static = "foo"; +} + +let c = new C(); + +verifyProperty(c, "static", { + value: "foo", + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field.js b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field.js new file mode 100644 index 0000000000..8a548867c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-instance-field.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-instance-field.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static is a valid name of an instance field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static; +} + +let c = new C(); + +verifyProperty(c, "static", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field-assigned.js b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field-assigned.js new file mode 100644 index 0000000000..808acee9c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field-assigned.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-static-field-assigned.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static is a valid name of a static field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + static FieldDefinition ; + +---*/ + + +var C = class { + static static = "test262"; +} + +verifyProperty(C, "static", { + value: "test262", + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field.js b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field.js new file mode 100644 index 0000000000..a275a57f5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-as-valid-static-field.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-static-field.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static is a valid name of a static field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + static FieldDefinition ; + +---*/ + + +var C = class { + static static; +} + +verifyProperty(C, "static", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..bec5785549 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-arguments.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-comp-name.template +/*--- +description: Syntax error if `arguments` used in class field (static computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public, computed-property-names] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + static [x] = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-super.js new file mode 100644 index 0000000000..0e4f6b1a29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-comp-name-init-err-contains-super.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-comp-name.template +/*--- +description: Syntax error if `super()` used in class field (static computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public, computed-property-names] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var x = "string"; +var C = class { + static [x] = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-length.js b/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-length.js new file mode 100644 index 0000000000..d8ecaa6b07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-length.js @@ -0,0 +1,64 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-field-anonymous-function-length.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Anonymous function in field initilizer have length properly set (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-private, class-static-fields-public, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassDefinitionEvaluation: + ... + + 27. Let staticFields be a new empty List. + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + ... + b. Else, + i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false. + c. If field is an abrupt completion, then + ... + d. If field is not empty, + i. If IsStatic of e is false, append field to instanceFields. + ii. Otherwise, append field to staticFields. + + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + ... + + DefineField(receiver, fieldRecord) + 1. Assert: Type(receiver) is Object. + 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. + 3. Let name be fieldRecord.[[Name]]. + 4. Let initializer be fieldRecord.[[Initializer]]. + 5. If initializer is not empty, then + a. Let initValue be ? Call(initializer, receiver). + ... + +---*/ + + +var C = class { + static #field = (a, b) => undefined; + static field = function() {}; + + static accessPrivateField() { + return this.#field; + } + +} + +assert.sameValue(C.accessPrivateField().length, 2); +assert.sameValue(C.field.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-name.js b/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-name.js new file mode 100644 index 0000000000..d16729f7df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-name.js @@ -0,0 +1,73 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-field-anonymous-function-name.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Anonymous function receives the name of static fields (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-private, class-static-fields-public, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassDefinitionEvaluation: + ... + + 27. Let staticFields be a new empty List. + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + ... + b. Else, + i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false. + c. If field is an abrupt completion, then + ... + d. If field is not empty, + i. If IsStatic of e is false, append field to instanceFields. + ii. Otherwise, append field to staticFields. + + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + ... + + DefineField(receiver, fieldRecord) + 1. Assert: Type(receiver) is Object. + 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. + 3. Let name be fieldRecord.[[Name]]. + 4. Let initializer be fieldRecord.[[Initializer]]. + 5. If initializer is not empty, then + a. Let initValue be ? Call(initializer, receiver). + 6. Else, let initValue be undefined. + 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then + a. Let hasNameProperty be ? HasOwnProperty(initValue, "name"). + b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName). + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). + 9. Else, + a. Assert: IsPropertyKey(fieldName) is true. + b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue). + 10. Return. + +---*/ + + +var C = class { + static #field = () => 'Test262'; + static field = function() { return 42; }; + + static accessPrivateField() { + return this.#field; + } + +} + +assert.sameValue(C.accessPrivateField().name, "#field"); +assert.sameValue(C.field.name, "field"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-field-declaration.js b/js/src/tests/test262/language/expressions/class/elements/static-field-declaration.js new file mode 100644 index 0000000000..cc3a227b20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-declaration.js @@ -0,0 +1,120 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-field-declaration.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Static fields are defined using DefineField (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Updated Productions + + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + ClassDefinitionEvaluation: + ... + + 27. Let staticFields be a new empty List. + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + ... + b. Else, + i. Let field be the result of performing PropertyDefinitionEvaluation for mClassElementEvaluation for e with arguments F and false. + c. If field is an abrupt completion, then + ... + d. If field is not empty, + i. If IsStatic of e is false, append field to instanceFields. + ii. Otherwise, append field to staticFields. + + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + ... + + DefineField(receiver, fieldRecord) + 1. Assert: Type(receiver) is Object. + 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. + 3. Let name be fieldRecord.[[Name]]. + 4. Let initializer be fieldRecord.[[Initializer]]. + 5. If initializer is not empty, then + a. Let initValue be ? Call(initializer, receiver). + 6. Else, let initValue be undefined. + 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then + a. Let hasNameProperty be ? HasOwnProperty(initValue, "name"). + b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName). + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). + 9. Else, + a. Assert: IsPropertyKey(fieldName) is true. + b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue). + 10. Return. + +---*/ +var computed = 'h'; + + +var C = class { + static f = 'test262'; + static 'g'; + static 0 = 'bar'; + static [computed]; +} + +let c = new C(); + +assert.sameValue(c.f, undefined); +assert.sameValue(c.g, undefined); +assert.sameValue(c.h, undefined); +assert.sameValue(c[0], undefined); + +assert.sameValue(Object.hasOwnProperty.call(c, 'f'), false); +assert.sameValue(Object.hasOwnProperty.call(c, 'g'), false); +assert.sameValue(Object.hasOwnProperty.call(c, 'h'), false); +assert.sameValue(Object.hasOwnProperty.call(c, 0), false); + +verifyProperty(C, 'f', { + value: 'test262', + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(C, 'g', { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(C, 0, { + value: 'bar', + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(C, 'h', { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-field-init-this-inside-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/static-field-init-this-inside-arrow-function.js new file mode 100644 index 0000000000..d3cf3824e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-init-this-inside-arrow-function.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-field-init-this-inside-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: this in static field initializers refers to class constructor (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassDefinitionEvaluation: + ... + + 27. Let staticFields be a new empty List. + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + ... + b. Else, + i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false. + c. If field is an abrupt completion, then + ... + d. If field is not empty, + i. If IsStatic of e is false, append field to instanceFields. + ii. Otherwise, append field to staticFields. + + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + ... + + DefineField(receiver, fieldRecord) + 1. Assert: Type(receiver) is Object. + 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. + 3. Let name be fieldRecord.[[Name]]. + 4. Let initializer be fieldRecord.[[Initializer]]. + 5. If initializer is not empty, then + a. Let initValue be ? Call(initializer, receiver). + 6. Else, let initValue be undefined. + 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then + a. Let hasNameProperty be ? HasOwnProperty(initValue, "name"). + b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName). + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). + 9. Else, + a. Assert: IsPropertyKey(fieldName) is true. + b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue). + 10. Return. + +---*/ + + +var C = class { + static f = () => this; +} + +assert.sameValue(C.f(), C); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-field-init-with-this.js b/js/src/tests/test262/language/expressions/class/elements/static-field-init-with-this.js new file mode 100644 index 0000000000..114006ab54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-init-with-this.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-field-init-with-this.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Static fields initializer has `this` biding (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassDefinitionEvaluation: + ... + + 27. Let staticFields be a new empty List. + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + ... + b. Else, + i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false. + c. If field is an abrupt completion, then + ... + d. If field is not empty, + i. If IsStatic of e is false, append field to instanceFields. + ii. Otherwise, append field to staticFields. + + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + ... + + DefineField(receiver, fieldRecord) + 1. Assert: Type(receiver) is Object. + 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. + 3. Let name be fieldRecord.[[Name]]. + 4. Let initializer be fieldRecord.[[Initializer]]. + 5. If initializer is not empty, then + a. Let initValue be ? Call(initializer, receiver). + 6. Else, let initValue be undefined. + 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then + a. Let hasNameProperty be ? HasOwnProperty(initValue, "name"). + b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName). + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). + 9. Else, + a. Assert: IsPropertyKey(fieldName) is true. + b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue). + 10. Return. + +---*/ + + +var C = class { + static f = 'test'; + static g = this.f + '262'; + static h = eval('this.g') + 'test'; +} + +assert.sameValue(C.f, 'test'); +assert.sameValue(C.g, 'test262'); +assert.sameValue(C.h, 'test262test'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-field-redeclaration.js b/js/src/tests/test262/language/expressions/class/elements/static-field-redeclaration.js new file mode 100644 index 0000000000..2318f50f20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-redeclaration.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-field-redeclaration.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Static fields can be redeclared (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +info: | + Updated Productions + + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassDefinitionEvaluation: + ... + + 27. Let staticFields be a new empty List. + 28. For each ClassElement e in order from elements, + a. If IsStatic of e is false, then + ... + b. Else, + i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false. + c. If field is an abrupt completion, then + ... + d. If field is not empty, + i. If IsStatic of e is false, append field to instanceFields. + ii. Otherwise, append field to staticFields. + + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + ... + + DefineField(receiver, fieldRecord) + 1. Assert: Type(receiver) is Object. + 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. + 3. Let name be fieldRecord.[[Name]]. + 4. Let initializer be fieldRecord.[[Initializer]]. + 5. If initializer is not empty, then + a. Let initValue be ? Call(initializer, receiver). + 6. Else, let initValue be undefined. + 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then + a. Let hasNameProperty be ? HasOwnProperty(initValue, "name"). + b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName). + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). + 9. Else, + a. Assert: IsPropertyKey(fieldName) is true. + b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue). + 10. Return. + +---*/ + + +var C = class { + static f = 'test'; + static f = this.f + '262'; + static g() { + return 45; + }; + static g = this.g(); +} + +assert.sameValue(C.f, 'test262'); +assert.sameValue(C.g, 45); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-arguments.js new file mode 100644 index 0000000000..2b32142f7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-literal-name.template +/*--- +description: Syntax error if `arguments` used in class field (static literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static x = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-super.js new file mode 100644 index 0000000000..2d0ac810c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-literal-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-literal-name.template +/*--- +description: Syntax error if `super()` used in class field (static literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static x = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-fields-proxy-default-handler-throws.js b/js/src/tests/test262/language/expressions/class/elements/static-private-fields-proxy-default-handler-throws.js new file mode 100644 index 0000000000..8533f5930a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-fields-proxy-default-handler-throws.js @@ -0,0 +1,31 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-privatefieldget +description: Static private fields not accessible via default Proxy handler +info: | + 1. Assert: P is a Private Name value. + 2. If O is not an object, throw a TypeError exception. + 3. Let entry be PrivateFieldFind(P, O). + 4. If entry is empty, throw a TypeError exception. + +features: [class, class-static-fields-private] +---*/ + +var C = class { + static #x = 1; + static x() { + return this.#x; + } +} + +var P = new Proxy(C, {}); + +assert.sameValue(C.x(), 1); +assert.throws(TypeError, function() { + P.x(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-arrow-function.js new file mode 100644 index 0000000000..754822df58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-arrow-function.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-getter-access-on-inner-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private getter access inside of an arrow function (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static get #f() { + return 'Test262'; + } + + static access() { + const arrowFunction = () => { + return this.#f; + }; + + return arrowFunction(); + } +} + +assert.sameValue(C.access(), 'Test262'); +assert.throws(TypeError, function() { + C.access.call({}); +}, 'Accessed static private getter from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-class.js b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-class.js new file mode 100644 index 0000000000..5489e8e61c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-class.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-getter-access-on-inner-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private getter access inside of an inner class (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-public, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static get #f() { + return 'Test262'; + } + + static Inner = class { + static access(o) { + return o.#f; + } + } +} + +assert.sameValue(C.Inner.access(C), 'Test262'); +assert.throws(TypeError, function() { + C.Inner.access(C.Inner); +}, 'Accessed static private getter from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-function.js b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-function.js new file mode 100644 index 0000000000..6461816804 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-function.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-getter-access-on-inner-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private getter access inside of a nested function (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static get #f() { + return 'Test262'; + } + + static access() { + const self = this; + + function innerFunction() { + return self.#f; + } + + return innerFunction(); + } +} + +assert.sameValue(C.access(), 'Test262'); +assert.throws(TypeError, function() { + C.access.call({}); +}, 'Accessed static private getter from an arbitrary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/static-private-getter.js new file mode 100644 index 0000000000..6843452384 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter.js @@ -0,0 +1,58 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-getter.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private getter declaration and usage (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassTail : ClassHeritage { ClassBody } + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + ... + 6. Else, + a. Assert: P.[[Kind]] is "accessor". + b. If P does not have a [[Get]] field, throw a TypeError exception. + c. Let getter be P.[[Get]]. + d. Return ? Call(getter, O). + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static get #f() { + return 'Test262'; + } + + static access() { + return this.#f; + } +} + +assert.sameValue(C.access(), 'Test262'); +assert.throws(TypeError, function() { + C.access.call({}); +}, 'Accessed static private getter from an arbitrary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-arguments.js new file mode 100644 index 0000000000..3908bcdbec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-private-name.template +/*--- +description: Syntax error if `arguments` used in class field (static PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static #x = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-super.js new file mode 100644 index 0000000000..9802cde01c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-private-name.template +/*--- +description: Syntax error if `super()` used in class field (static PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static #x = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-arrow-function.js new file mode 100644 index 0000000000..ac5ab56899 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-arrow-function.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-method-access-on-inner-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Static private method access inside of an arrow function (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static #f() { return 42; } + static g() { + const arrowFunction = () => { + return this.#f(); + }; + + return arrowFunction(); + } + +} + +assert.sameValue(C.g(), 42); +assert.throws(TypeError, function() { + C.g.call({}); +}, 'Accessed static private method from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-function.js b/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-function.js new file mode 100644 index 0000000000..1e67071b40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-function.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-method-access-on-inner-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Static private method access inside of a nested function (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static #f() { return 42; } + static g() { + const self = this; + + function innerFunction() { + return self.#f(); + } + + return innerFunction(); + } + +} + +assert.sameValue(C.g(), 42); +assert.throws(TypeError, function() { + C.g.call({}); +}, 'Accessed static private method from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-method-and-instance-method-brand-check.js b/js/src/tests/test262/language/expressions/class/elements/static-private-method-and-instance-method-brand-check.js new file mode 100644 index 0000000000..e579f93b63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-and-instance-method-brand-check.js @@ -0,0 +1,67 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-method-and-instance-method-brand-check.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Brand for static private names and instance private names are different (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-methods-private, class] +flags: [generated] +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 32. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] field is proto, + a. Set F.[[PrivateBrand]] to proto. + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + ... + + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static #f() { + return 'static'; + } + + static access() { + return this.#f(); + } + + #instanceMethod() { + return 'instance'; + } + + instanceAccess() { + return this.#instanceMethod(); + } +} + +let c = new C(); +assert.sameValue(C.access(), 'static'); +assert.sameValue(c.instanceAccess(), 'instance'); + +assert.throws(TypeError, function() { + C.access.call(c); +}, 'Accessed static private method from instance of C'); + +assert.throws(TypeError, function() { + c.instanceAccess.call(C); +}, 'Accessed instance private method from C'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-method-referenced-from-instance-method.js b/js/src/tests/test262/language/expressions/class/elements/static-private-method-referenced-from-instance-method.js new file mode 100644 index 0000000000..87fca58a0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-referenced-from-instance-method.js @@ -0,0 +1,41 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-method-referenced-from-instance-method.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Static private method referenced from an instance method (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static #f() { return 42; } + g() { + return this.#f(); + } + +} + +assert.sameValue(new C().g.call(C), 42); +assert.throws(TypeError, function() { + new C().g(); +}, 'Accessed static private method from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-method-subclass-receiver.js b/js/src/tests/test262/language/expressions/class/elements/static-private-method-subclass-receiver.js new file mode 100644 index 0000000000..073626f60e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-subclass-receiver.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-method-subclass-receiver.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Static private methods on the super-class cannot be called with sub-class as the receiver (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static f() { return this.#g(); } + static #g() { return 42; } + +} + +class D extends C {} +assert.sameValue(C.f(), 42); +assert.throws(TypeError, function() { + D.f(); +}, 'D does not contain static private method #g'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-methods-proxy-default-handler-throws.js b/js/src/tests/test262/language/expressions/class/elements/static-private-methods-proxy-default-handler-throws.js new file mode 100644 index 0000000000..d2281eb41c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-methods-proxy-default-handler-throws.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-privatefieldget +description: Static private methods not accessible via default Proxy handler +info: | + 1. Assert: P is a Private Name value. + 2. If O is not an object, throw a TypeError exception. + 3. Let entry be PrivateFieldFind(P, O). + 4. If entry is empty, throw a TypeError exception. + +features: [class, class-static-methods-private] +---*/ + + +var C = class { + static #x(value) { + return 1; + } + static x() { + return this.#x(); + } +} + +var P = new Proxy(C, {}); + +assert.sameValue(C.x(), 1); +assert.throws(TypeError, function() { + P.x(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-arrow-function.js new file mode 100644 index 0000000000..599be3a0ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-arrow-function.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-setter-access-on-inner-arrow-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private setter access inside of an arrow function (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static set #f(v) { + this._v = v; + } + + static access() { + const arrowFunction = () => { + this.#f = 'Test262'; + }; + + arrowFunction(); + } +} + +C.access(); +assert.sameValue(C._v, 'Test262'); +assert.throws(TypeError, function() { + C.access.call({}); +}, 'Accessed static private setter from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-class.js b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-class.js new file mode 100644 index 0000000000..2390b201f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-class.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-setter-access-on-inner-class.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private setter access inside of an inner class (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-public, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static set #f(v) { + return this._v = v; + } + + static Inner = class { + static access(o) { + o.#f = 'Test262'; + } + } + +} + +C.Inner.access(C) +assert.sameValue(C._v, 'Test262'); +assert.throws(TypeError, function() { + C.Inner.access(C.Inner); +}, 'Accessed static private setter from an object which did not contain it'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-function.js b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-function.js new file mode 100644 index 0000000000..763aa9ff6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-function.js @@ -0,0 +1,50 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-setter-access-on-inner-function.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private setter access inside of a nested function (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + a. Return P.[[Value]]. + ... + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static set #f(v) { + this._v = v; + } + + static access() { + const self = this; + + function innerFunction() { + self.#f = 'Test262'; + } + + innerFunction(); + } +} + +C.access(); +assert.sameValue(C._v, 'Test262'); +assert.throws(TypeError, function() { + C.access.call({}); +}, 'Accessed static private setter from an arbitrary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/static-private-setter.js new file mode 100644 index 0000000000..17a48d9c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-setter.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static private setter declaration and usage (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-methods-private, class] +flags: [generated] +info: | + MethodDefinition : + get ClassElementName () { FunctionBody } + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassTail : ClassHeritage { ClassBody } + ... + 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F, + a. PrivateBrandAdd(F, F). + 34. For each item fieldRecord in order from staticFields, + a. Perform ? DefineField(F, field). + + PrivateFieldGet (P, O) + 1. Assert: P is a Private Name. + 2. If O is not an object, throw a TypeError exception. + 3. If P.[[Kind]] is "field", + ... + 4. Perform ? PrivateBrandCheck(O, P). + 5. If P.[[Kind]] is "method", + ... + 6. Else, + a. Assert: P.[[Kind]] is "accessor". + b. If P does not have a [[Get]] field, throw a TypeError exception. + c. Let getter be P.[[Get]]. + d. Return ? Call(getter, O). + + PrivateBrandCheck(O, P) + 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true, + a. Throw a TypeError exception. + +---*/ + + +var C = class { + static set #f(v) { + this._v = v; + } + + static access() { + this.#f = 'Test262'; + } +} + +C.access(); +assert.sameValue(C._v, 'Test262'); +assert.throws(TypeError, function() { + C.access.call({}); +}, 'Accessed static private setter from an arbitrary object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..c2e0110350 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-static-string-literal-name.template +/*--- +description: Syntax error if `arguments` used in class field (static string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static 'x' = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..daa30b0d65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-string-literal-name-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-static-string-literal-name.template +/*--- +description: Syntax error if `super()` used in class field (static string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, class-static-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static 'x' = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..2256c69eda --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-string-literal-name.template +/*--- +description: Syntax error if `arguments` used in class field (string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + 'x' = arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..c4e66fee60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/string-literal-name-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-string-literal-name.template +/*--- +description: Syntax error if `super()` used in class field (string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + 'x' = super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/browser.js b/js/src/tests/test262/language/expressions/class/elements/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/browser.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js new file mode 100644 index 0000000000..82db7c4134 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/class-heritage-array-literal-arrow-heritage.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name. (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassTail : ClassHeritage { ClassBody } + + ClassHeritage : + extends LeftHandSideExpression + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends () => {} { + +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js new file mode 100644 index 0000000000..bc9e9e4f0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/class-heritage-array-literal-async-arrow-heritage.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name. (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassTail : ClassHeritage { ClassBody } + + ClassHeritage : + extends LeftHandSideExpression + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends async () => {} { + +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/browser.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..0ac35f7262 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class-fields-public, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#m); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..281801179d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-methods-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#m); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js new file mode 100644 index 0000000000..5118bf51a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#m); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js new file mode 100644 index 0000000000..a0ad8d842b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#m); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js new file mode 100644 index 0000000000..86a12e866e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#m); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js new file mode 100644 index 0000000000..6b3b46aa6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#m); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js new file mode 100644 index 0000000000..0f7b98dc52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#m); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js new file mode 100644 index 0000000000..4a73e796e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete (g().#x); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..818f7daa58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#m +); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..59674f3c4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#m +); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js new file mode 100644 index 0000000000..eeeeb3f4d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#m +); + + async *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js new file mode 100644 index 0000000000..4942f33237 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#m +); + + async #m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js new file mode 100644 index 0000000000..37bb4ee79d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#m +); + + *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js new file mode 100644 index 0000000000..05b0924dc5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#m +); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js new file mode 100644 index 0000000000..6e10b845bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#m); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js new file mode 100644 index 0000000000..6e56f3672a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-field-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in field, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete (this.#x); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..f0d42d3ca7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class-fields-public, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#m; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..3c54c04e9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-methods-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#m; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js new file mode 100644 index 0000000000..8f8fb0767e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#m; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js new file mode 100644 index 0000000000..c29901811b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#m; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js new file mode 100644 index 0000000000..ab30366fd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#m; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js new file mode 100644 index 0000000000..cf3636c909 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#m; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js new file mode 100644 index 0000000000..032f38867e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#m; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js new file mode 100644 index 0000000000..cd9e0d6c61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete g().#x; + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..ed52556679 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#m +; + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..8fac99788b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#m +; + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js new file mode 100644 index 0000000000..abfb81061a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#m +; + + async *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js new file mode 100644 index 0000000000..d625a8967f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#m +; + + async #m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js new file mode 100644 index 0000000000..0373eb0e6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#m +; + + *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js new file mode 100644 index 0000000000..c541aa8481 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#m +; + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js new file mode 100644 index 0000000000..758581226c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js @@ -0,0 +1,38 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#m; + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js new file mode 100644 index 0000000000..bacf51b086 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js @@ -0,0 +1,38 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-field-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in field) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete this.#x; + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..c7d8b8761f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class-fields-public, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#m)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..d0088d69f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-methods-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#m)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js new file mode 100644 index 0000000000..6ed28009b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#m)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js new file mode 100644 index 0000000000..4d55d332c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#m)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js new file mode 100644 index 0000000000..f2b9f528e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#m)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js new file mode 100644 index 0000000000..71aa4e22d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#m)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js new file mode 100644 index 0000000000..83a7876777 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#m)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js new file mode 100644 index 0000000000..c5267dee0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + g = this.f; + x = delete ((g().#x)); + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..50deafdb75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#m +)); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..f35d2963fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#m +)); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js new file mode 100644 index 0000000000..104efa3414 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#m +)); + + async *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js new file mode 100644 index 0000000000..43e63eb187 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#m +)); + + async #m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js new file mode 100644 index 0000000000..cfcf3c3274 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#m +)); + + *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js new file mode 100644 index 0000000000..30b1ea6425 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js @@ -0,0 +1,45 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#m +)); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js new file mode 100644 index 0000000000..a6dc490e4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#m)); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js new file mode 100644 index 0000000000..eb0cf63c34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-field-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in field, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x = delete ((this.#x)); + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..4c4266bc0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class-fields-public, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#m); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..dc2ed8ae86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-methods-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#m); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js new file mode 100644 index 0000000000..cadfb70cfa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#m); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js new file mode 100644 index 0000000000..6a86897e32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#m); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js new file mode 100644 index 0000000000..103c4d8f03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#m); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js new file mode 100644 index 0000000000..77ae189c56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#m); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js new file mode 100644 index 0000000000..414489a3db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#m); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js new file mode 100644 index 0000000000..6819afe22b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete (g().#x); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..9254c637ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#m +); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..93c252a50d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#m +); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js new file mode 100644 index 0000000000..19baf4f50b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#m +); + } + + async *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js new file mode 100644 index 0000000000..47bbea4722 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#m +); + } + + async #m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js new file mode 100644 index 0000000000..aa9320685d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#m +); + } + + *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js new file mode 100644 index 0000000000..4bcde6bfac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#m +); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js new file mode 100644 index 0000000000..8e0ccea10a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#m); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js new file mode 100644 index 0000000000..b589909c8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-method-delete-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in method, covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete (this.#x); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..58cb824387 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class-fields-public, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#m; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..15d9c899d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-methods-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#m; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js new file mode 100644 index 0000000000..874a936b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#m; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js new file mode 100644 index 0000000000..00ad29fb1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#m; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js new file mode 100644 index 0000000000..e796b9f005 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#m; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js new file mode 100644 index 0000000000..ff4f4c8bea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#m; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js new file mode 100644 index 0000000000..afeb3b7104 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#m; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js new file mode 100644 index 0000000000..e42ffc3c4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js @@ -0,0 +1,43 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete g().#x; + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..97a9c802ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#m +; + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..cc7b2547c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#m +; + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js new file mode 100644 index 0000000000..1dbebe7d50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#m +; + } + + async *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js new file mode 100644 index 0000000000..903a88a2d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#m +; + } + + async #m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js new file mode 100644 index 0000000000..63ccc9aedc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#m +; + } + + *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js new file mode 100644 index 0000000000..cae060da65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#m +; + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js new file mode 100644 index 0000000000..036ee3cb5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js @@ -0,0 +1,41 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#m; + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js new file mode 100644 index 0000000000..d35687165a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js @@ -0,0 +1,41 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-method-delete.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in method) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete this.#x; + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..b995a8bce0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class-fields-public, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#m)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..0c10458069 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private, class-methods-private, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#m)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js new file mode 100644 index 0000000000..0fee3ad0be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#m)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js new file mode 100644 index 0000000000..d8fbec22b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#m)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js new file mode 100644 index 0000000000..d9aa54b974 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#m)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js new file mode 100644 index 0000000000..c9819cf743 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#m)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js new file mode 100644 index 0000000000..fe9f9d9133 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#m)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js new file mode 100644 index 0000000000..4061f086e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js @@ -0,0 +1,49 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-call-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + var g = this.f; + delete ((g().#x)); + } + + f() { + return this; + } +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js new file mode 100644 index 0000000000..ae90e0aefc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#m +)); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js new file mode 100644 index 0000000000..39f5072f60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#m +)); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js new file mode 100644 index 0000000000..09d550ad3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-iteration, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#m +)); + } + + async *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js new file mode 100644 index 0000000000..e65f75595e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-async.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, async-functions, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#m +)); + } + + async #m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js new file mode 100644 index 0000000000..4ecfb3a363 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method-gen.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, generators, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#m +)); + } + + *#m() {} +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js new file mode 100644 index 0000000000..1c375730d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-method.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-methods-private, class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#m +)); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js new file mode 100644 index 0000000000..917c6f4af4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-private-no-reference.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#m)); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js new file mode 100644 index 0000000000..ea03c72105 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js @@ -0,0 +1,47 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/err-delete-member-expression-privatename.case +// - src/class-elements/delete-error/cls-expr-method-delete-twice-covered.template +/*--- +description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in method, recursively covered) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + This file must never use the onlyStrict flag as the strict mode should always + be observed inside class bodies. + + Static Semantics: Early Errors + + UnaryExpression : delete UnaryExpression + + It is a Syntax Error if the UnaryExpression is contained in strict mode + code and the derived UnaryExpression is + PrimaryExpression : IdentifierReference , + MemberExpression : MemberExpression.PrivateName , or + CallExpression : CallExpression.PrivateName . + + It is a Syntax Error if the derived UnaryExpression is + PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and + CoverParenthesizedExpressionAndArrowParameterList ultimately derives a + phrase that, if used in place of UnaryExpression, would produce a + Syntax Error according to these rules. This rule is recursively applied. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + x() { + + delete ((this.#x)); + } + + +} diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/shell.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/delete/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js new file mode 100644 index 0000000000..03da89dd58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-class-body-ctor-duplicate.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It is a SyntaxError if the class body has more than one constructor (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassBody : ClassElementList + It is a Syntax Error if PrototypePropertyNameList of ClassElementList contains more + than one occurrence of "constructor". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + constructor() {} + constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js new file mode 100644 index 0000000000..b5bed2447f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-ctor-super-no-heritage.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It is a SyntaxError if class has no heritage and constructor has a direct super (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassTail : ClassHeritageopt { ClassBody } + + It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true: + 1. Let constructor be ConstructorMethod of ClassBody. + 2. If constructor is empty, return false. + 3. Return HasDirectSuper of constructor. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + constructor() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js new file mode 100644 index 0000000000..8eb2bdf13e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js @@ -0,0 +1,71 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-identifier-invalid-ues-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Invalid FieldDefinition, ClassElementName, PropertyName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + \u0000; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js new file mode 100644 index 0000000000..5593b75c4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js @@ -0,0 +1,71 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-identifier-invalid-zwj-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Invalid FieldDefinition, ClassElementName, PropertyName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + \u200D_ZWJ; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js new file mode 100644 index 0000000000..f116c19c29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js @@ -0,0 +1,71 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-identifier-invalid-zwnj-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Invalid FieldDefinition, ClassElementName, PropertyName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + \u200C_ZWNJ; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-fields-same-line-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-fields-same-line-error.js new file mode 100644 index 0000000000..195c83740f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-fields-same-line-error.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-fields-same-line-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: SyntaxError (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x y +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js new file mode 100644 index 0000000000..871eeb1d59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-environment-on-class-heritage-array-literal.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name. (class expression) +esid: prod-ClassElement +features: [class-fields-private, class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context. + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + 8. If ClassBodyopt is present, then + a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt, + i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true). + 9. If ClassHeritageopt is not present, then + a. Let protoParent be the intrinsic object %ObjectPrototype%. + b. Let constructorParent be the intrinsic object %FunctionPrototype%. + 10. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage. + ... + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends (o) => [o.#foo] +{ + #foo; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js new file mode 100644 index 0000000000..0d46fbde66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-environment-on-class-heritage-chained-usage.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class expression evaluated on ClassHeritage uses an private name declared on subclass. (class expression) +esid: prod-ClassElement +features: [class-fields-private, class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context. + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + 8. If ClassBodyopt is present, then + a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt, + i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true). + 9. If ClassHeritageopt is not present, then + a. Let protoParent be the intrinsic object %ObjectPrototype%. + b. Let constructorParent be the intrinsic object %FunctionPrototype%. + 10. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage. + ... + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends class extends class extends class { x = this.#foo; } { #foo; x = this.#bar; } { #bar; x = this.#fuz; } +{ + #fuz; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js new file mode 100644 index 0000000000..22bd1e4041 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-environment-on-class-heritage-function-expression.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a function expression evaluated on ClassHeritage uses a private name. (class expression) +esid: prod-ClassElement +features: [class-fields-private, class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context. + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + 8. If ClassBodyopt is present, then + a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt, + i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true). + 9. If ClassHeritageopt is not present, then + a. Let protoParent be the intrinsic object %ObjectPrototype%. + b. Let constructorParent be the intrinsic object %FunctionPrototype%. + 10. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage. + ... + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends function() { x = this.#foo; } +{ + #foo; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js new file mode 100644 index 0000000000..7ef6cd7539 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-environment-on-class-heritage-obj-literal.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a object literal evaluated on ClassHeritage uses a private name. (class expression) +esid: prod-ClassElement +features: [class-fields-private, class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context. + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + 8. If ClassBodyopt is present, then + a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt, + i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true). + 9. If ClassHeritageopt is not present, then + a. Let protoParent be the intrinsic object %ObjectPrototype%. + b. Let constructorParent be the intrinsic object %FunctionPrototype%. + 10. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage. + ... + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends (o) => {x: o.#foo} +{ + #foo; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js new file mode 100644 index 0000000000..624a0bc734 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-environment-on-class-heritage-recursive.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class expression evaluated on ClassHeritage of a ClassHeritage uses an undeclared private name. (class expression) +esid: prod-ClassElement +features: [class-fields-private, class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context. + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + 8. If ClassBodyopt is present, then + a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt, + i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true). + 9. If ClassHeritageopt is not present, then + a. Let protoParent be the intrinsic object %ObjectPrototype%. + b. Let constructorParent be the intrinsic object %FunctionPrototype%. + 10. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage. + ... + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends class extends class { x = this.#foo; } {} +{ + #foo; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js new file mode 100644 index 0000000000..64d268e518 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-environment-on-class-heritage.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class expression evaluated on ClassHeritage uses an undeclared private name. (class expression) +esid: prod-ClassElement +features: [class-fields-private, class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context. + 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment). + 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord. + 8. If ClassBodyopt is present, then + a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt, + i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true). + 9. If ClassHeritageopt is not present, then + a. Let protoParent be the intrinsic object %ObjectPrototype%. + b. Let constructorParent be the intrinsic object %FunctionPrototype%. + 10. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage. + ... + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends class { x = this.#foo; } +{ + #foo; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js new file mode 100644 index 0000000000..4e40e227c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-field-on-object-destructuring.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Acessing private field from object destructuring pattern is not a valid syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, destructuring-binding, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ObjectAssignmentPattern[Yield, Await]: + {} + {AssignmentRestProperty[?Yield, ?Await]} + {AssignmentPropertyList[?Yield, ?Await]} + {AssignmentPropertyList[?Yield, ?Await],AssignmentRestProperty[?Yield, ?Await]opt} + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = 1; + + destructureX() { + const { #x: x } = this; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-super-access.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-super-access.js new file mode 100644 index 0000000000..e5bc32a1a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-private-field-super-access.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-private-field-super-access.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Acessing private field from super is not a valid syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + MemberExpression[Yield]: + MemberExpression[?Yield].PrivateName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m = function() { return 'test262'; }; + + Child = class extends C { + access() { + return super.#m; + } + + method() { + return super.#m(); + } + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js new file mode 100644 index 0000000000..55ef05ea36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-async-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private async generator and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, async-iteration, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m; + async * #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js new file mode 100644 index 0000000000..8ee8fbae4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-async.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private async function and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, async-functions, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m; + async #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js new file mode 100644 index 0000000000..32d51ec7b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private generator and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, generators, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m; + * #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js new file mode 100644 index 0000000000..8c84381e66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private getter and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m; + get #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js new file mode 100644 index 0000000000..e2fdf2276c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-get.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private getters with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + get #m() {} + get #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js new file mode 100644 index 0000000000..fdd0594149 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m; + #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js new file mode 100644 index 0000000000..eff2760416 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-get.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private getter with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + get #m() {} + #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js new file mode 100644 index 0000000000..defa641ca8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private methods with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m() {} + #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js new file mode 100644 index 0000000000..c96b2cb0c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-set.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private setter with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + set #m(_) {} + #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js new file mode 100644 index 0000000000..65cfe52128 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-staticfield.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private static field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-static-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static #m; + #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js new file mode 100644 index 0000000000..27df46b325 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-staticmeth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private static method with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static #m() {} + #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js new file mode 100644 index 0000000000..6b8b13dce9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-set-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private setter and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #m; + set #m(_) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js new file mode 100644 index 0000000000..cf087ebf3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-set-set.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private setters with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + set #m(_) {} + set #m(_) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-constructor.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-constructor.js new file mode 100644 index 0000000000..494359452b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-constructor.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-constructor.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Private Fields cannot be named constructor (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElementName : PrivateName ; + It is a Syntax Error if StringValue of PrivateName is "#constructor" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #constructor +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-error.js new file mode 100644 index 0000000000..714e718332 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-error.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigial and IdentifierName (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + # x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js new file mode 100644 index 0000000000..a075563d89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js @@ -0,0 +1,65 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-invalid-ues.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Valid PrivateName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #\u0000; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js new file mode 100644 index 0000000000..8651c749b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js @@ -0,0 +1,66 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-invalid-zwj-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Valid PrivateName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #\u200D_ZWJ; + +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js new file mode 100644 index 0000000000..45136325fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js @@ -0,0 +1,66 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-invalid-zwnj-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Valid PrivateName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #\u200C_ZWNJ; + +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js new file mode 100644 index 0000000000..2b9d8cf988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-in-computed-property-missing.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Use of undeclared PrivateName in ComputedProperty is a syntax error (class expression) +esid: prod-ClassElement +features: [class-fields-private, class-fields-public, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElementName: + PropertyName + PrivateIdentifier + + PropertyName: + LiteralPropertyName + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] + + AssignmentExpression ... MemberExpression + + MemberExpression: + MemberExpression . PrivateName + + Static Semantics: AllPrivateIdentifiersValid + AllPrivateIdentifiersValid is an abstract operation which takes names as an argument. + + MemberExpression : MemberExpression . PrivateIdentifier + 1. If StringValue of PrivateIdentifier is in names, return true. + 2. Return false. + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundIdentifiers of ClassBody. + 2. Return AllPrivateIdentifiersValid of ClassElementList with the argument newNames. + + Static Semantics: Early Errors + + ScriptBody : StatementList + It is a Syntax Error if AllPrivateIdentifiersValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + [this.#f] = 'Test262' +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js new file mode 100644 index 0000000000..b0d7fdb74e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-accessor-get-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName () (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + get # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js new file mode 100644 index 0000000000..c0b71777f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-accessor-set-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Accessor set Method) (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + set # m(_) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js new file mode 100644 index 0000000000..3aad7081cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-async-gen-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Async Generator Method) (class expression) +esid: prod-ClassElement +features: [async-iteration, class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + async * # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js new file mode 100644 index 0000000000..88c35fce64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-async-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Async Method) (class expression) +esid: prod-ClassElement +features: [async-functions, class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + async # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js new file mode 100644 index 0000000000..cd27b04b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-call-expr.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (CallExpression) (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + MemberExpression : + MemberExpression . PrivateName + + CallExpression : + CallExpression . PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + + f() { + return this; + } + + m() { + this.f().# x; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js new file mode 100644 index 0000000000..761cc6047d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-field-init.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Field with Initializer) (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + # x = 1; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js new file mode 100644 index 0000000000..e17f091cb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Field) (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + # x; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js new file mode 100644 index 0000000000..bd0fe23ced --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-gen-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Generator Method) (class expression) +esid: prod-ClassElement +features: [generators, class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + * # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js new file mode 100644 index 0000000000..c8fbf4304c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-member-expr.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (MemberExpression) (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + MemberExpression : + MemberExpression . PrivateName + + CallExpression : + CallExpression . PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x; + m() { + this.# x; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js new file mode 100644 index 0000000000..b34eff7ba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-meth.case.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Method) (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js new file mode 100644 index 0000000000..7a3072dd9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-accessor-get-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Static Accessor get Method) (class expression) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static get # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js new file mode 100644 index 0000000000..a9d1e182a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-accessor-set-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Static Accessor set Method) (class expression) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static set # m(_) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js new file mode 100644 index 0000000000..350f552263 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-async-gen-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Static Async Generator Method) (class expression) +esid: prod-ClassElement +features: [async-iteration, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static async * # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js new file mode 100644 index 0000000000..7ea3f03939 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-async-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Async Method) (class expression) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static async # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js new file mode 100644 index 0000000000..9f7beb88fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-field-init.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Static Field with Initializer) (class expression) +esid: prod-ClassElement +features: [class-static-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static # x = 1; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js new file mode 100644 index 0000000000..3b39da8371 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Static Field) (class expression) +esid: prod-ClassElement +features: [class-static-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static # x; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js new file mode 100644 index 0000000000..2d0f842904 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-gen-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Static Generator Method) (class expression) +esid: prod-ClassElement +features: [generators, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static * # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js new file mode 100644 index 0000000000..321813ec21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js @@ -0,0 +1,30 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-whitespace-error-static-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: No space allowed between sigil and IdentifierName (Static Method) (class expression) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Updated Productions + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static # m() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js new file mode 100644 index 0000000000..af8a8946a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatenames-same-line-error.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: SyntaxError (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x #y +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js new file mode 100644 index 0000000000..4a14cfc68a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-async-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Async Generator Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + async * method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js new file mode 100644 index 0000000000..4e730e6cce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-async.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Async Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + async method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js new file mode 100644 index 0000000000..ed359acf1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Generator Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + * method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js new file mode 100644 index 0000000000..abe21071b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-get.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Accessor get Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + get method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js new file mode 100644 index 0000000000..65ff8cedb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-method.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js new file mode 100644 index 0000000000..0dfb280e6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-private-async-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Private Async Generators Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-iteration, class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + async * #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js new file mode 100644 index 0000000000..f855db8186 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-private-async.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Private Async Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-functions, class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + async #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js new file mode 100644 index 0000000000..b44c81b469 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-private-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Private Generators Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [generators, class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + * #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js new file mode 100644 index 0000000000..8e3f00949c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-private-method.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Private Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js new file mode 100644 index 0000000000..ea1f444e26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-contains-super-set.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Accessor set Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + set method(_) { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js new file mode 100644 index 0000000000..fafd93217e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-ctor-async-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Async Generator Methods cannot be named "constructor" (class expression) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + async * constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js new file mode 100644 index 0000000000..2ddc1484a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-ctor-async-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Async Methods cannot be named "constructor" (class expression) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + async constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js new file mode 100644 index 0000000000..d2a097d885 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-ctor-gen.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Generator Methods cannot be named "constructor" (class expression) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + * constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js new file mode 100644 index 0000000000..1f7a82091c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-ctor-get.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Accessor get Methods cannot be named "constructor" (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + get constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js new file mode 100644 index 0000000000..f4d0eb692f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-meth-ctor-set.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Accessor set Methods cannot be named "constructor" (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + set constructor(_) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js new file mode 100644 index 0000000000..71ed3b4c64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-async-gen-meth-prototype.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Generator Methods cannot be named prototype (class expression) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static async * prototype() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js new file mode 100644 index 0000000000..c9210159fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-async-gen-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Generator Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static async * method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js new file mode 100644 index 0000000000..2bddcc2c09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-async-meth-prototype.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Methods cannot be named prototype (class expression) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static async prototype() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-super.js new file mode 100644 index 0000000000..aa40e45b51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-async-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static async method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js new file mode 100644 index 0000000000..9a596bc853 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-gen-meth-prototype.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Generator Methods cannot be named prototype (class expression) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static * prototype() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js new file mode 100644 index 0000000000..def3cb1572 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-gen-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Generator Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static * method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js new file mode 100644 index 0000000000..554b88539b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-get-meth-prototype.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Accessor get Methods cannot be named prototype (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static get prototype() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-super.js new file mode 100644 index 0000000000..5a8909c4e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-get-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Accessor get Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static get method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-prototype.js new file mode 100644 index 0000000000..6db6567c1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-prototype.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-meth-prototype.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Methods cannot be named prototype (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static prototype() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-super.js new file mode 100644 index 0000000000..caf2ae5f50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js new file mode 100644 index 0000000000..8e4d260b3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-gen-meth-constructor.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Generator Private Methods cannot be named constructor (class expression) +esid: prod-ClassElement +features: [async-iteration, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElementName : PrivateName ; + It is a Syntax Error if StringValue of PrivateName is "#constructor" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static async * #constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js new file mode 100644 index 0000000000..0973e2cd57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-gen-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Generator Private Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-iteration, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static async * #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js new file mode 100644 index 0000000000..e30d021db4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-meth-constructor.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Private Methods cannot be named constructor (class expression) +esid: prod-ClassElement +features: [async-functions, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElementName : PrivateName ; + It is a Syntax Error if StringValue of PrivateName is "#constructor" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static async #constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js new file mode 100644 index 0000000000..54b5f597ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Async Private Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [async-functions, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static async #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js new file mode 100644 index 0000000000..2993eb2f6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-gen-meth-constructor.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Generator Private Methods cannot be named constructor (class expression) +esid: prod-ClassElement +features: [generators, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElementName : PrivateName ; + It is a Syntax Error if StringValue of PrivateName is "#constructor" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static * #constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js new file mode 100644 index 0000000000..dd91264f09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-gen-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Generator Private Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [generators, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static * #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js new file mode 100644 index 0000000000..50c1b7ab1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-meth-constructor.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Private Methods cannot be named constructor (class expression) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElementName : PrivateName ; + It is a Syntax Error if StringValue of PrivateName is "#constructor" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static #constructor() {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-super.js new file mode 100644 index 0000000000..f5c1ba370c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-private-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Private Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static #method() { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js new file mode 100644 index 0000000000..16bb2d0a74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-privatename-constructor.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Private Fields cannot be named constructor (class expression) +esid: prod-ClassElement +features: [class-static-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElementName : PrivateName ; + It is a Syntax Error if StringValue of PrivateName is "#constructor" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static #constructor +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js new file mode 100644 index 0000000000..b70a612536 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-set-meth-prototype.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Accessor set Methods cannot be named prototype (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + static set prototype(_) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-super.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-super.js new file mode 100644 index 0000000000..a007d94d20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-set-meth-super.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: Static Accessor set Methods cannot contain direct super (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends Function{ + static set method(_) { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/browser.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js new file mode 100644 index 0000000000..b7dbddf0bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = (() => {})().#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js new file mode 100644 index 0000000000..e9571d612f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = (() => this)().#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..b35a2c200a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { (() => {})().#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js new file mode 100644 index 0000000000..7f38fb2cdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { (() => this)().#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..eae46002b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { something.#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js new file mode 100644 index 0000000000..444ad05a91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { this.#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..080ad6e49b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js @@ -0,0 +1,57 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = (() => {})().#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js new file mode 100644 index 0000000000..16675904d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js @@ -0,0 +1,57 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = (() => this)().#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..a4aa0c5273 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js @@ -0,0 +1,57 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = something.#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js new file mode 100644 index 0000000000..f095e8f1ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js @@ -0,0 +1,57 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = this.#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js new file mode 100644 index 0000000000..e7d59a1792 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = something.#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js new file mode 100644 index 0000000000..546d3dfaa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = this.#x +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js new file mode 100644 index 0000000000..a1ee743917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { (() => {})().#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js new file mode 100644 index 0000000000..4301aa6a15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { (() => this)().#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..a8625f28ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js @@ -0,0 +1,55 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { (() => {})().#x } + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js new file mode 100644 index 0000000000..46c3a9fa2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js @@ -0,0 +1,55 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { (() => this)().#x } + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..758c94f991 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js @@ -0,0 +1,55 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { something.#x } + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js new file mode 100644 index 0000000000..ad8e057e0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js @@ -0,0 +1,55 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { this.#x } + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..3a3aa7727c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + (() => {})().#x + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js new file mode 100644 index 0000000000..0158a0b45b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + (() => this)().#x + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..bfe6887bfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + something.#x + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js new file mode 100644 index 0000000000..fc88c924a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + this.#x + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js new file mode 100644 index 0000000000..d173e0e672 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { something.#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js new file mode 100644 index 0000000000..e722e49930 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { this.#x } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js new file mode 100644 index 0000000000..a0906e1edf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js new file mode 100644 index 0000000000..3584d98bc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js new file mode 100644 index 0000000000..a61fdeb85f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js new file mode 100644 index 0000000000..098068fc37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/shell.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/invalid-names/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js new file mode 100644 index 0000000000..e96f119bba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-async-generator-cannot-escape-token.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: The pound signal in the private async generator cannot be escaped (class expression) +esid: prod-ClassElement +features: [class-methods-private, async-iteration, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + PrivateName:: + # IdentifierName + + U+0023 is the escape sequence for # + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + async * \u0023m() { return 42; } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js new file mode 100644 index 0000000000..cfef5d3ecf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-async-method-cannot-escape-token.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: The pound signal in the private async method cannot be escaped (class expression) +esid: prod-ClassElement +features: [class-methods-private, async-functions, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + PrivateName:: + # IdentifierName + + U+0023 is the escape sequence for # + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + async \u0023m() { return 42; } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js new file mode 100644 index 0000000000..dfd34de302 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-call-exp-cannot-escape-token.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: The pound signal in the private reference cannot be escaped (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + PrivateName :: + # IdentifierName + + MemberExpression : + MemberExpression . PrivateName + + CallExpression : + CallExpression . PrivateName + + U+0023 is the escape sequence for # + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + method() { + foo().\u0023field; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-field-cannot-escape-token.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-field-cannot-escape-token.js new file mode 100644 index 0000000000..09f6ffeafe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-field-cannot-escape-token.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-cannot-escape-token.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: The pound signal in the private field cannot be escaped (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + PrivateName:: + # IdentifierName + + U+0023 is the escape sequence for # + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + \u0023field; +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js new file mode 100644 index 0000000000..a273f86e33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-generator-cannot-escape-token.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: The pound signal in the private generator cannot be escaped (class expression) +esid: prod-ClassElement +features: [class-methods-private, generators, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + PrivateName:: + # IdentifierName + + U+0023 is the escape sequence for # + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + * \u0023m() { return 42; } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js new file mode 100644 index 0000000000..81fb34860d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js @@ -0,0 +1,34 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-member-exp-cannot-escape-token.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: The pound signal in the private reference cannot be escaped (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + PrivateName :: + # IdentifierName + + MemberExpression : + MemberExpression . PrivateName + + CallExpression : + CallExpression . PrivateName + + U+0023 is the escape sequence for # + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + method() { + this.\u0023field; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-method-cannot-escape-token.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-method-cannot-escape-token.js new file mode 100644 index 0000000000..08d1daab32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/private-method-cannot-escape-token.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-cannot-escape-token.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: The pound signal in the private method cannot be escaped (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + PrivateName:: + # IdentifierName + + U+0023 is the escape sequence for # + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + \u0023m() { return 42; } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/shell.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js new file mode 100644 index 0000000000..2a745e288d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/super-private-access-invalid.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It is syntax error if PrivateName IdentifierName is accessed on SuperProperty (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + SuperProperty: + super[Expression] + super.IdentifierName + +---*/ + + +$DONOTEVALUATE(); + +var C = class extends B +{ + #x() {} + + method() { + super.#x(); + } +}; diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/shell.js b/js/src/tests/test262/language/expressions/class/elements/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/browser.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js new file mode 100644 index 0000000000..92137ad521 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-class-body-ctor-no-heritage.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: A constructor is valid without a super call in the constructor and heritage (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +info: | + ClassTail : ClassHeritageopt { ClassBody } + + It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true: + 1. Let constructor be ConstructorMethod of ClassBody. + 2. If constructor is empty, return false. + 3. Return HasDirectSuper of constructor. + +---*/ + + +var C = class { + constructor() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js new file mode 100644 index 0000000000..1a731074d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-classelementname-initializer-alt.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; + _ = 2; + \u{6F} = 3; + ℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‌_NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‍_J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer.js new file mode 100644 index 0000000000..f26a8180ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-classelementname-initializer.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-classelementname-initializer.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $ = 1; + _ = 2; + \u{6F} = 3; + \u2118 = 4; + ZW_\u200C_NJ = 5; + ZW_\u200D_J = 6; +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier-alt.js new file mode 100644 index 0000000000..fab559ecee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier-alt.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-identifier-alt.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; + _; + \u{6F}; + ℘; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‌_NJ; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‍_J; // DO NOT CHANGE THE NAME OF THIS FIELD +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier.js new file mode 100644 index 0000000000..5557474be6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-identifier.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-identifier.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + $; + _; + \u{6F}; + \u2118; + ZW_\u200C_NJ; + ZW_\u200D_J; +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-fields-multi-line.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-fields-multi-line.js new file mode 100644 index 0000000000..9843ba163f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-fields-multi-line.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-fields-multi-line.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Valid multi-line, multi-field (class expression) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + +---*/ + + +var C = class { + x + y +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js new file mode 100644 index 0000000000..74156eaa59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js @@ -0,0 +1,24 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-set.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: It's valid if a class contains a private getter and a private setter with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +var C = class { + get #m() {} + set #m(_) {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js new file mode 100644 index 0000000000..16924ae966 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js @@ -0,0 +1,29 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-nestedclassmeth.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: It's valid if a nested class shadows a private method (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +var C = class { + constructor() { + class B { + #m() {} + } + } + + #m() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js new file mode 100644 index 0000000000..c4a1159b68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-classelementname-initializer-alt.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Valid PrivateName = Initializer Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; + #_ = 2; + #\u{6F} = 3; + #℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD + #ZW_‌_NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD + #ZW_‍_J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js new file mode 100644 index 0000000000..6150e1d228 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js @@ -0,0 +1,70 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-classelementname-initializer.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Valid PrivateName = Initializer Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$ = 1; + #_ = 2; + #\u{6F} = 3; + #\u2118 = 4; + #ZW_\u200C_NJ = 5; + #ZW_\u200D_J = 6; +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-identifier.js new file mode 100644 index 0000000000..99c01e7406 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-identifier.js @@ -0,0 +1,67 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Valid PrivateName Syntax (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + #$; + #_; + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J; +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js new file mode 100644 index 0000000000..d8f122f475 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-no-initializer-with-method.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: SyntaxError (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +var C = class { + #x + m() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatenames-multi-line.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatenames-multi-line.js new file mode 100644 index 0000000000..272ae3592c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatenames-multi-line.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatenames-multi-line.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: SyntaxError (class expression) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +var C = class { + #x + #y +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js new file mode 100644 index 0000000000..5ef5f9b3d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-accessor-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Accessor Methods can be named "prototype" (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + MethodDefinition : get PropertyName ( ) { FunctionBody } + + [...] + 9. Let desc be the PropertyDescriptor { [[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 10. Return ? DefinePropertyOrThrow(object, propKey, desc). + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + [...] + 8. Let desc be the PropertyDescriptor { [[Set]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 9. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +var C = class { + get prototype() { return 13; } + set prototype(_) {} +}; + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +assert.sameValue(C.prototype.prototype, 13); +verifyProperty(C.prototype, 'prototype', { + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js new file mode 100644 index 0000000000..fc5e1bfacd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-async-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Async Generator Methods can be named "prototype" (class expression) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + [...] + 10. Let desc be PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 11. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +var C = class { + async * prototype() {} +}; + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js new file mode 100644 index 0000000000..f6e24e4aff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-async-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Async Methods can be named "prototype" (class expression) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + [...] + 8. Let desc be the PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 9. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +var C = class { + async prototype() {} +}; + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js new file mode 100644 index 0000000000..83676bd5ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Generator Methods can be named "prototype" (class expression) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + [...] + 10. Let desc be the PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 11. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +var C = class { + * prototype() {} +}; + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js new file mode 100644 index 0000000000..790bb30409 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Methods can be named "prototype" (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + [...] + 3. Let desc be the PropertyDescriptor { [[Value]]: methodDef.[[Closure]], [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 4. Return ? DefinePropertyOrThrow(object, methodDef.[[Key]], desc). + +---*/ + + +var C = class { + prototype() {} +}; + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js new file mode 100644 index 0000000000..6efb50847b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-accessor-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Accessor Methods can be named constructor (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +var C = class { + static get constructor() {} + static set constructor(_) {} + constructor() {} // stacks with a valid constructor +}; + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js new file mode 100644 index 0000000000..2689f31801 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-async-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Async Generator Methods can be named constructor (class expression) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +var C = class { + static async * constructor() {} + constructor() {} // stacks with a valid constructor +}; + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js new file mode 100644 index 0000000000..757b3a45db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-async-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Methods can be named constructor (class expression) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +var C = class { + static async constructor() {} + constructor() {} // stacks with a valid constructor +}; + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js new file mode 100644 index 0000000000..af241a4866 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Generator Methods can be named constructor (class expression) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +var C = class { + static * constructor() {} + constructor() {} // stacks with a valid constructor +}; + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js new file mode 100644 index 0000000000..41908e065d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-meth-valid.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Methods can be named constructor (class expression) +esid: prod-ClassElement +features: [class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +var C = class { + static constructor() {} + constructor() {} // stacks with a valid constructor +}; + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js new file mode 100644 index 0000000000..65a66e7737 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-gen-meth-prototype.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Async Generator Private Methods can be named "#prototype" (class expression) +esid: prod-ClassElement +features: [async-iteration, class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +var C = class { + static async * #prototype() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js new file mode 100644 index 0000000000..dfc04eaaed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-meth-prototype.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Async Private Methods can be named "#prototype" (class expression) +esid: prod-ClassElement +features: [async-functions, class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +var C = class { + static async #prototype() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js new file mode 100644 index 0000000000..3429223917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-gen-meth-prototype.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Generator Private Methods can be named "#prototype" (class expression) +esid: prod-ClassElement +features: [generators, class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +var C = class { + static * #prototype() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-meth-prototype.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-meth-prototype.js new file mode 100644 index 0000000000..d54a237758 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-meth-prototype.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-meth-prototype.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Static Private Methods can be named "#prototype" (class expression) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +var C = class { + static #prototype() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/syntax/valid/shell.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-arguments.js new file mode 100644 index 0000000000..39c220b5b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-ternary.template +/*--- +description: Syntax error if `arguments` used in class field (ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = true ? {} : arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-super.js new file mode 100644 index 0000000000..c99488b0fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/ternary-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-ternary.template +/*--- +description: Syntax error if `super()` used in class field (ternary expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = true ? {} : super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-arguments.js new file mode 100644 index 0000000000..94324d65a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-arguments.case +// - src/class-elements/initializer-error/cls-expr-fields-typeof.template +/*--- +description: Syntax error if `arguments` used in class field (typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = typeof arguments; +} diff --git a/js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-super.js b/js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-super.js new file mode 100644 index 0000000000..b194a0bb75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/typeof-init-err-contains-super.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/class-elements/init-err-contains-super.case +// - src/class-elements/initializer-error/cls-expr-fields-typeof.template +/*--- +description: Syntax error if `super()` used in class field (typeof expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + x = typeof super(); +} diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-names.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-names.js new file mode 100644 index 0000000000..a85f16d841 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-names.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Computed property names (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-public, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + ;;;; + ;;;;;;[x] = 42; [10] = "meep"; ["not initialized"];;;;;;; + ;;;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-symbol-names.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-symbol-names.js new file mode 100644 index 0000000000..048df664c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-symbol-names.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/computed-symbol-names.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Computed property symbol names (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-public, Symbol, computed-property-names, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + ;;;; + ;;;;;;[x]; [y] = 42;;;;;;; + ;;;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); +assert.sameValue(Object.hasOwnProperty.call(C, x), false); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); +assert.sameValue(Object.hasOwnProperty.call(C, y), false); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); +assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js new file mode 100644 index 0000000000..3226834ffa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,98 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: PrivateName Static Semantics, StringValue (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + + + 1. Return the String value consisting of the sequence of code + units corresponding to PrivateName. In determining the sequence + any occurrences of \ UnicodeEscapeSequence are first replaced + with the code point represented by the UnicodeEscapeSequence + and then the code points of the entire PrivateName are converted + to code units by UTF16Encoding (10.1.1) each code point. + +---*/ + + +var C = class { + ;;;; + ;;;;;;#\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J;;;;;;;; + ;;;; + o(value) { + this.#o = value; + return this.#o; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.o(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names-asi.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names-asi.js new file mode 100644 index 0000000000..fd445f9098 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names-asi.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names-asi.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Literal property names with ASI (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + ;;;; + ;;;;;;a + b = 42;;;;;;;; + ;;;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names.js new file mode 100644 index 0000000000..ecd7ec55f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/literal-names.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Literal property names (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + ;;;; + ;;;;;;a; b = 42; + c = fn;;;;;;; + ;;;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: fn, + enumerable: true, + writable: true, + configurable: true +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-field-usage.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-field-usage.js new file mode 100644 index 0000000000..1df0ac1a00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-field-usage.js @@ -0,0 +1,38 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-field-usage.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: PrivateName CallExpression usage (private field) (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + ;;;; + ;;;;;;#m = 'test262';;;;;;;; + ;;;; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-getter-usage.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-getter-usage.js new file mode 100644 index 0000000000..334f914b70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-getter-usage.js @@ -0,0 +1,38 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-getter-usage.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: PrivateName CallExpression usage (Accesor get method) (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + ;;;; + ;;;;;;get #m() { return 'test262'; };;;;;;; + ;;;; + method() { + return this.#m; + } +} + +var c = new C(); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-usage.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-usage.js new file mode 100644 index 0000000000..aeaced13eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-usage.js @@ -0,0 +1,38 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-method-usage.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: PrivateName CallExpression usage (private method) (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class, class-fields-public] +flags: [generated] +info: | + Updated Productions + + CallExpression[Yield, Await]: + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + CallExpression[?Yield, ?Await].PrivateName + +---*/ + + +var C = class { + ;;;; + ;;;;;;#m() { return 'test262'; };;;;;;; + ;;;; + method() { + return this.#m(); + } +} + +var c = new C(); + +assert.sameValue(c.method(), 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-names.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-names.js new file mode 100644 index 0000000000..e496c3cd98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-names.js @@ -0,0 +1,60 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/private-names.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: private names (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ;;;; + ;;;;;;#x; #y;;;;;;; + ;;;; + x() { + this.#x = 42; + return this.#x; + } + y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(c.x(), 42, "test 7"); +assert.sameValue(c.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js new file mode 100644 index 0000000000..4f0d700fb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier-initializer.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid FieldDefinition (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;$ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;;;;;;; + ;;;; + +} + +var c = new C(); + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier.js new file mode 100644 index 0000000000..9ddc49a830 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-field-identifier.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-field-identifier.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid FieldDefinition (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;$; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;;;;;;; + ;;;; + +} + +var c = new C(); + +c.$ = 1; +c._ = 1; +c.\u{6F} = 1; +c.\u2118 = 1; +c.ZW_\u200C_NJ = 1; +c.ZW_\u200D_J = 1; + +assert.sameValue(c.$, 1); +assert.sameValue(c._, 1); +assert.sameValue(c.\u{6F}, 1); +assert.sameValue(c.\u2118, 1); +assert.sameValue(c.ZW_\u200C_NJ, 1); +assert.sameValue(c.ZW_\u200D_J, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter-alt.js new file mode 100644 index 0000000000..c9459028bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter-alt.js @@ -0,0 +1,117 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName as private getter (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #℘() { + return this.#℘_; + } + get #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + get #ZW_‍_J() { + return this.#ZW_‍_J_; + } +;;;;;;; + ;;;; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘_ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter.js new file mode 100644 index 0000000000..2d78a41c2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter.js @@ -0,0 +1,117 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-getter.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName as private getter (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + get #$() { + return this.#$_; + } + get #_() { + return this.#__; + } + get #\u{6F}() { + return this.#\u{6F}_; + } + get #\u2118() { + return this.#\u2118_; + } + get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +;;;;;;; + ;;;; + $(value) { + this.#$_ = value; + return this.#$; + } + _(value) { + this.#__ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method-alt.js new file mode 100644 index 0000000000..b55528699b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method-alt.js @@ -0,0 +1,116 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName as private method (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #℘() { + return this.#℘_; + } + #ZW_‌_NJ() { + return this.#ZW_‌_NJ_; + } + #ZW_‍_J() { + return this.#ZW_‍_J_; + } +;;;;;;; + ;;;; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + ℘(value) { + this.#℘_ = value; + return this.#℘(); + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + return this.#ZW_‌_NJ(); + } + ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + return this.#ZW_‍_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method.js new file mode 100644 index 0000000000..1c368bef8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method.js @@ -0,0 +1,116 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-method.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName as private method (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + #$() { + return this.#$_; + } + #_() { + return this.#__; + } + #\u{6F}() { + return this.#\u{6F}_; + } + #\u2118() { + return this.#\u2118_; + } + #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; + } + #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; + } +;;;;;;; + ;;;; + $(value) { + this.#$_ = value; + return this.#$(); + } + _(value) { + this.#__ = value; + return this.#_(); + } + \u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); + } + \u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter-alt.js new file mode 100644 index 0000000000..8f5c606a93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter-alt.js @@ -0,0 +1,116 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName as private setter (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #℘(value) { + this.#℘_ = value; + } + set #ZW_‌_NJ(value) { + this.#ZW_‌_NJ_ = value; + } + set #ZW_‍_J(value) { + this.#ZW_‍_J_ = value; + } +;;;;;;; + ;;;; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + ℘(value) { + this.#℘ = value; + return this.#℘_; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ_; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter.js new file mode 100644 index 0000000000..71fd89c7bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter.js @@ -0,0 +1,116 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-private-setter.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName as private setter (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-methods-private, class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; + set #$(value) { + this.#$_ = value; + } + set #_(value) { + this.#__ = value; + } + set #\u{6F}(value) { + this.#\u{6F}_ = value; + } + set #\u2118(value) { + this.#\u2118_ = value; + } + set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + } + set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + } +;;;;;;; + ;;;; + $(value) { + this.#$ = value; + return this.#$_; + } + _(value) { + this.#_ = value; + return this.#__; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; + } + +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js new file mode 100644 index 0000000000..a895be6aa1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js @@ -0,0 +1,98 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;;;;;;; + ;;;; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + ℘(value) { + this.#℘ = value; + return this.#℘; + } + ZW_‌_NJ(value) { + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + ZW_‍_J(value) { + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW_‌_NJ(1), 1); +assert.sameValue(c.ZW_‍_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..ebb0ee19e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;;;;;;; + ;;;; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + ℘() { + return this.#℘; + } + ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.℘(), 1); +assert.sameValue(c.ZW_‌_NJ(), 1); +assert.sameValue(c.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js new file mode 100644 index 0000000000..f641aaff92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js @@ -0,0 +1,92 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;;;;;;; + ;;;; + $() { + return this.#$; + } + _() { + return this.#_; + } + \u{6F}() { + return this.#\u{6F}; + } + \u2118() { + return this.#\u2118; + } + ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(), 1); +assert.sameValue(c._(), 1); +assert.sameValue(c.\u{6F}(), 1); +assert.sameValue(c.\u2118(), 1); +assert.sameValue(c.ZW_\u200C_NJ(), 1); +assert.sameValue(c.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier.js new file mode 100644 index 0000000000..db28667195 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier.js @@ -0,0 +1,98 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-privatename-identifier.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;#$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;;;;;;; + ;;;; + $(value) { + this.#$ = value; + return this.#$; + } + _(value) { + this.#_ = value; + return this.#_; + } + \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..f0f80e9e06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #o(value) { + yield * await value; + } + static async * #℘(value) { + yield * await value; + } + static async * #ZW_‌_NJ(value) { + yield * await value; + } + static async * #ZW_‍_J(value) { + yield * await value; + };;;;;;; + ;;;; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.o([1]).next(), + C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..3a176b232a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static AsyncGeneratorMethod PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncGeneratorMethod + + AsyncGeneratorMethod : + async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static async * #$(value) { + yield * await value; + } + static async * #_(value) { + yield * await value; + } + static async * #\u{6F}(value) { + yield * await value; + } + static async * #\u2118(value) { + yield * await value; + } + static async * #ZW_\u200C_NJ(value) { + yield * await value; + } + static async * #ZW_\u200D_J(value) { + yield * await value; + };;;;;;; + ;;;; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +Promise.all([ + C.$([1]).next(), + C._([1]).next(), + C.\u{6F}([1]).next(), + C.\u2118([1]).next(), + C.ZW_\u200C_NJ([1]).next(), + C.ZW_\u200D_J([1]).next(), +]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..98aa088943 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static AsyncMethod PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #o(value) { + return await value; + } + static async #℘(value) { + return await value; + } + static async #ZW_‌_NJ(value) { + return await value; + } + static async #ZW_‍_J(value) { + return await value; + };;;;;;; + ;;;; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async o(value) { + return await this.#o(value); + } + static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#℘(value); + } + static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‌_NJ(value); + } + static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return await this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js new file mode 100644 index 0000000000..3e1df27230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) async -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-async-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static AsyncMethod PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + AsyncMethod + + AsyncMethod : + async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static async #$(value) { + return await value; + } + static async #_(value) { + return await value; + } + static async #\u{6F}(value) { + return await value; + } + static async #\u2118(value) { + return await value; + } + static async #ZW_\u200C_NJ(value) { + return await value; + } + static async #ZW_\u200D_J(value) { + return await value; + };;;;;;; + ;;;; + static async $(value) { + return await this.#$(value); + } + static async _(value) { + return await this.#_(value); + } + static async \u{6F}(value) { + return await this.#\u{6F}(value); + } + static async \u2118(value) { + return await this.#\u2118(value); + } + static async ZW_\u200C_NJ(value) { + return await this.#ZW_\u200C_NJ(value); + } + static async ZW_\u200D_J(value) { + return await this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), +]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..3f5f8f859f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,113 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static GeneratorMethod PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #o(value) { + yield * value; + } + static * #℘(value) { + yield * value; + } + static * #ZW_‌_NJ(value) { + yield * value; + } + static * #ZW_‍_J(value) { + yield * value; + };;;;;;; + ;;;; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get o() { + return this.#o; + } + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; + } + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; + } + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; + } + +} + +var c = new C(); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.o([1]).next().value, 1); +assert.sameValue(C.℘([1]).next().value, 1); +assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_‍_J([1]).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js new file mode 100644 index 0000000000..8d7d283c56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,114 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-generator-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static GeneratorMethod PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + GeneratorMethod + + GeneratorMethod : + * ClassElementName ( UniqueFormalParameters ){ GeneratorBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static * #$(value) { + yield * value; + } + static * #_(value) { + yield * value; + } + static * #\u{6F}(value) { + yield * value; + } + static * #\u2118(value) { + yield * value; + } + static * #ZW_\u200C_NJ(value) { + yield * value; + } + static * #ZW_\u200D_J(value) { + yield * value; + };;;;;;; + ;;;; + static get $() { + return this.#$; + } + static get _() { + return this.#_; + } + static get \u{6F}() { + return this.#\u{6F}; + } + static get \u2118() { + return this.#\u2118; + } + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } + +} + +var c = new C(); + +assert.sameValue(C.$([1]).next().value, 1); +assert.sameValue(C._([1]).next().value, 1); +assert.sameValue(C.\u{6F}([1]).next().value, 1); +assert.sameValue(C.\u2118([1]).next().value, 1); +assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1); +assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js new file mode 100644 index 0000000000..70a0d39b04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,111 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static Method PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #o(value) { + return value; + } + static #℘(value) { + return value; + } + static #ZW_‌_NJ(value) { + return value; + } + static #ZW_‍_J(value) { + return value; + };;;;;;; + ;;;; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static o(value) { + return this.#o(value); + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘(value); + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ(value); + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js new file mode 100644 index 0000000000..ae8bd7c329 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js @@ -0,0 +1,111 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-method-privatename-identifier.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static Method PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ){ FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$(value) { + return value; + } + static #_(value) { + return value; + } + static #\u{6F}(value) { + return value; + } + static #\u2118(value) { + return value; + } + static #ZW_\u200C_NJ(value) { + return value; + } + static #ZW_\u200D_J(value) { + return value; + };;;;;;; + ;;;; + static $(value) { + return this.#$(value); + } + static _(value) { + return this.#_(value); + } + static \u{6F}(value) { + return this.#\u{6F}(value); + } + static \u2118(value) { + return this.#\u2118(value); + } + static ZW_\u200C_NJ(value) { + return this.#ZW_\u200C_NJ(value); + } + static ZW_\u200D_J(value) { + return this.#ZW_\u200D_J(value); + } + +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js new file mode 100644 index 0000000000..cf6732e731 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;;;;;;; + ;;;; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static o(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#℘ = value; + return C.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‌_NJ = value; + return C.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + C.#ZW_‍_J = value; + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js new file mode 100644 index 0000000000..0f3118a830 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;;;;;;; + ;;;; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static o(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#℘ = value; + return this.#℘; + } + static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‌_NJ = value; + return this.#ZW_‌_NJ; + } + static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD + this.#ZW_‍_J = value; + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.o(1), 1); +assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD +assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js new file mode 100644 index 0000000000..017d34270c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-by-classname.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;;;;;;; + ;;;; + static $(value) { + C.#$ = value; + return C.#$; + } + static _(value) { + C.#_ = value; + return C.#_; + } + static \u{6F}(value) { + C.#\u{6F} = value; + return C.#\u{6F}; + } + static \u2118(value) { + C.#\u2118 = value; + return C.#\u2118; + } + static ZW_\u200C_NJ(value) { + C.#ZW_\u200C_NJ = value; + return C.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + C.#ZW_\u200D_J = value; + return C.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js new file mode 100644 index 0000000000..dc52cf28d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;;;;;;; + ;;;; + static $() { + return C.#$; + } + static _() { + return C.#_; + } + static \u{6F}() { + return C.#\u{6F}; + } + static ℘() { + return C.#℘; + } + static ZW_‌_NJ() { + return C.#ZW_‌_NJ; + } + static ZW_‍_J() { + return C.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js new file mode 100644 index 0000000000..0cd63a3b69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;;;;;;; + ;;;; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static ℘() { + return this.#℘; + } + static ZW_‌_NJ() { + return this.#ZW_‌_NJ; + } + static ZW_‍_J() { + return this.#ZW_‍_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.℘(), 1); +assert.sameValue(C.ZW_‌_NJ(), 1); +assert.sameValue(C.ZW_‍_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js new file mode 100644 index 0000000000..c0fce81e1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,93 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier-initializer.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;;;;;;; + ;;;; + static $() { + return this.#$; + } + static _() { + return this.#_; + } + static \u{6F}() { + return this.#\u{6F}; + } + static \u2118() { + return this.#\u2118; + } + static ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J() { + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(), 1); +assert.sameValue(C._(), 1); +assert.sameValue(C.\u{6F}(), 1); +assert.sameValue(C.\u2118(), 1); +assert.sameValue(C.ZW_\u200C_NJ(), 1); +assert.sameValue(C.ZW_\u200D_J(), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js new file mode 100644 index 0000000000..4883988619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/rs-static-privatename-identifier.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Valid Static PrivateName (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;;;;;;; + ;;;; + static $(value) { + this.#$ = value; + return this.#$; + } + static _(value) { + this.#_ = value; + return this.#_; + } + static \u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}; + } + static \u2118(value) { + this.#\u2118 = value; + return this.#\u2118; + } + static ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ; + } + static ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J; + } +} + +var c = new C(); + +assert.sameValue(C.$(1), 1); +assert.sameValue(C._(1), 1); +assert.sameValue(C.\u{6F}(1), 1); +assert.sameValue(C.\u2118(1), 1); +assert.sameValue(C.ZW_\u200C_NJ(1), 1); +assert.sameValue(C.ZW_\u200D_J(1), 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-fields.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-fields.js new file mode 100644 index 0000000000..d738ac01d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-fields.js @@ -0,0 +1,60 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-fields.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: static private fields (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #x; static #y;;;;;;; + ;;;; + static x() { + this.#x = 42; + return this.#x; + } + static y() { + this.#y = 43; + return this.#y; + } +} + +var c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods-with-fields.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods-with-fields.js new file mode 100644 index 0000000000..a8c9dca996 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods-with-fields.js @@ -0,0 +1,77 @@ +// |reftest| shell-option(--enable-private-fields) shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods-with-fields.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: static private methods with fields (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #xVal; static #yVal;;;;;;; + ;;;; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods.js new file mode 100644 index 0000000000..dd42ea095c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods.js @@ -0,0 +1,64 @@ +// |reftest| shell-option(--enable-private-methods) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/class-elements/static-private-methods.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: static private methods (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ;;;; + ;;;;;;;;;;;;; + ;;;; + static #x(value) { + return value / 2; + } + static #y(value) { + return value * 2; + } + static x() { + return this.#x(84); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 86, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-string-literal-names.js b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-string-literal-names.js new file mode 100644 index 0000000000..2943e2b772 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-string-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/string-literal-names.case +// - src/class-elements/productions/cls-expr-wrapped-in-sc.template +/*--- +description: String literal names (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + ;;;; + ;;;;;;'a'; "b"; 'c' = 39; + "d" = 42;;;;;;; + ;;;; + +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); -- cgit v1.2.3